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