cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to use DNS cache in curl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 15 Nov 2013 10:36:16 +0100 (CET)

On Thu, 14 Nov 2013, Gaurav Rastogi -X (garastog - ARICENT TECHNOLOGIES MAURIITIUS LIMITED at Cisco) wrote:

> I want to use DNS caching feature of curl as currently every time I make
> https request a DNS request is sent. Due to this my performance is
> downgraded and also sometimes DNS takes too much time due to which my https
> requests timeouts. Let me know with an example how to enable DNS caching in
> CURL.

libcurl uses its DNS cache by default as long as you re-use the handle. You
can change the time it'll hold entries in the cache - it is only meant to aid
"spikes" or rapid requests to the same host names as it doesn't get the "true"
TTL values.

The multi interface or the share interface allow you to share the cache over
multiple simultanoues requests.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-15