CURLOPT_DNS_USE_GLOBAL_CACHE.md (1496B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_DNS_USE_GLOBAL_CACHE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_DNS_CACHE_TIMEOUT (3) 9 - CURLOPT_SHARE (3) 10 Protocol: 11 - All 12 Added-in: 7.9.3 13 --- 14 15 # NAME 16 17 CURLOPT_DNS_USE_GLOBAL_CACHE - global DNS cache 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_USE_GLOBAL_CACHE, 25 long enable); 26 ~~~ 27 28 # DESCRIPTION 29 30 Has no function since 7.62.0. Do not use. 31 32 Pass a long. If the *enable* value is 1, it tells curl to use a global DNS 33 cache that survives between easy handle creations and deletions. This is not 34 thread-safe and this uses a global variable. 35 36 See CURLOPT_SHARE(3) and curl_share_init(3) for the correct way to share DNS 37 cache between transfers. 38 39 # DEFAULT 40 41 0 42 43 # %PROTOCOLS% 44 45 # EXAMPLE 46 47 ~~~c 48 int main(void) 49 { 50 CURL *curl = curl_easy_init(); 51 if(curl) { 52 CURLcode ret; 53 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 54 /* switch off the use of a global, thread unsafe, cache */ 55 curl_easy_setopt(curl, CURLOPT_DNS_USE_GLOBAL_CACHE, 0L); 56 ret = curl_easy_perform(curl); 57 curl_easy_cleanup(curl); 58 } 59 } 60 61 ~~~ 62 63 # DEPRECATED 64 65 Deprecated since 7.11.1. Functionality removed in 7.62.0. 66 67 # %AVAILABILITY% 68 69 # RETURN VALUE 70 71 curl_easy_setopt(3) returns a CURLcode indicating success or error. 72 73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 74 libcurl-errors(3).