1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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) 13Protocol: 14 - TLS 15TLS-backend: 16 - OpenSSL 17--- 18 19# NAME 20 21CURLOPT_CA_CACHE_TIMEOUT - life-time for cached certificate stores 22 23# SYNOPSIS 24 25~~~c 26#include <curl/curl.h> 27 28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CA_CACHE_TIMEOUT, long age); 29~~~ 30 31# DESCRIPTION 32 33Pass a long, this sets the timeout in seconds. This tells libcurl the maximum 34time any cached certificate store it has in memory may be kept and reused for 35new connections. Once the timeout has expired, a subsequent fetch requiring a 36certificate has to reload it. 37 38Building a certificate store from a CURLOPT_CAINFO(3) file is a slow 39operation so curl may cache the generated certificate store internally to speed 40up future connections. 41 42Set to zero to completely disable caching, or set to -1 to retain the cached 43store remain forever. By default, libcurl caches this info for 24 hours. 44 45# DEFAULT 46 4786400 (24 hours) 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