Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
CURLOPT_DNS_CACHE_TIMEOUT(3) | Library Functions Manual | CURLOPT_DNS_CACHE_TIMEOUT(3) |
NAME
CURLOPT_DNS_CACHE_TIMEOUT - life-time for DNS cache entriesSYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_CACHE_TIMEOUT, long age);
DESCRIPTION
Pass a long, this sets the timeout in seconds. Name resolve results are kept in memory and used for this number of seconds. Set to zero to completely disable caching, or set to -1 to make the cached entries remain forever. By default, libcurl caches this info for 60 seconds.DEFAULT
60PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
/* only reuse addresses for a short time */
curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 2L);
res = curl_easy_perform(curl);
/* in this second request, the cache is not be used if more than
two seconds have passed since the previous name resolve */
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
AVAILABILITY
Added in curl 7.9.3RETURN VALUE
Returns CURLE_OKSEE ALSO
CURLOPT_CONNECTTIMEOUT_MS(3), CURLOPT_DNS_SERVERS(3), CURLOPT_DNS_USE_GLOBAL_CACHE(3), CURLOPT_MAXAGE_CONN(3), CURLOPT_RESOLVE(3)2024-11-23 | libcurl |