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
12Added-in: 7.9.3
13---
14
15# NAME
16
17CURLOPT_DNS_USE_GLOBAL_CACHE - global DNS cache
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_USE_GLOBAL_CACHE,
25                          long enable);
26~~~
27
28# DESCRIPTION
29
30Has no function since 7.62.0. Do not use!
31
32Pass a long. If the *enable* value is 1, it tells curl to use a global DNS
33cache that survives between easy handle creations and deletions. This is not
34thread-safe and this uses a global variable.
35
36See CURLOPT_SHARE(3) and curl_share_init(3) for the correct way to share DNS
37cache between transfers.
38
39# DEFAULT
40
410
42
43# %PROTOCOLS%
44
45# EXAMPLE
46
47~~~c
48int 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
65Deprecated since 7.11.1. Functionality removed in 7.62.0.
66
67# %AVAILABILITY%
68
69# RETURN VALUE
70
71Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
72