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