1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_CA_CACHE_TIMEOUT 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_CAINFO (3) 9 - CURLOPT_CAINFO_BLOB (3) 10 - CURLOPT_CAPATH (3) 11 - CURLOPT_SSL_VERIFYHOST (3) 12 - CURLOPT_SSL_VERIFYPEER (3) 13--- 14 15# NAME 16 17CURLOPT_CA_CACHE_TIMEOUT - life-time for cached certificate stores 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age); 25~~~ 26 27# DESCRIPTION 28 29Pass a long, this sets the timeout in seconds. This tells libcurl the maximum 30time any cached certificate store it has in memory may be kept and reused for 31new connections. Once the timeout has expired, a subsequent fetch requiring a 32certificate has to reload it. 33 34Building a certificate store from a CURLOPT_CAINFO(3) file is a slow 35operation so curl may cache the generated certificate store internally to speed 36up future connections. 37 38Set to zero to completely disable caching, or set to -1 to retain the cached 39store remain forever. By default, libcurl caches this info for 24 hours. 40 41# DEFAULT 42 4386400 (24 hours) 44 45# PROTOCOLS 46 47All 48 49# EXAMPLE 50 51~~~c 52int main(void) 53{ 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode res; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 58 59 /* only reuse certificate stores for a short time */ 60 curl_easy_setopt(curl, CURLOPT_CA_CACHE_TIMEOUT, 60L); 61 62 res = curl_easy_perform(curl); 63 64 /* in this second request, the cache is not used if more than 65 sixty seconds passed since the previous connection */ 66 res = curl_easy_perform(curl); 67 68 curl_easy_cleanup(curl); 69 } 70} 71~~~ 72 73# AVAILABILITY 74 75This option was added in curl 7.87.0. 76 77This option is supported by OpenSSL and its forks (since 7.87.0) and Schannel 78(since 8.5.0). 79 80# RETURN VALUE 81 82Returns CURLE_OK 83