1AnyEvent::CacheDNS(3) User Contributed Perl DocumentationAnyEvent::CacheDNS(3)
2
3
4
6 AnyEvent::CacheDNS - Simple DNS resolver with caching
7
9 use AnyEvent;
10 use AnyEvent::HTTP;
11
12 # Register our DNS resolver as the default resolver
13 use AnyEvent::CacheDNS ':register';
14
15 # Use AnyEvent as ususal
16 my $cond = AnyEvent->condvar;
17 http_get "http://search.cpan.org/", sub { $cond->send(); };
18 $cond->recv();
19
21 This module provides a very simple DNS resolver that caches its results
22 and can improve the connection times to remote hosts.
23
25 It's possible to register the this class as AnyEvent's main DNS
26 resolver by passing the tag ":register" in the "use" statement.
27
29 register
30 Registers a new DNS cache instance as AnyEvent's global DNS resolver.
31
32 ENVIRONMENT
33 "PERL_ANYEVENT_DNS_TTL"
34 The effect of setting this variable differs depending on AnyEvent
35 version.
36
37 AnyEvent 5.x
38 Default DNS response record cache TTL for older AnyEvent
39 versions. AnyEvent::DNS <= 6.x doesn't report record TTL and
40 records get cached for infinite amount of time, therefore
41 running programs won't detect if cached DNS records have
42 changed.
43
44 NOTE: Setting this variable to 0 disables purging records from
45 cache.
46
47 AnyEvent 6.x
48 Newer versions of AnyEvent report DNS record TTL so records
49 will be purged from the cache after their TTL expires. Setting
50 this variable to any positive integer OVERRIDES the TTL for all
51 records to the specified value, setting variable to 0 disables
52 purging records from the cache.
53
55 Emmanuel Rodriguez <potyl@cpan.org>
56
58 (C) 2011 Emmanuel Rodriguez - All Rights Reserved.
59
60
61
62perl v5.36.0 2023-01-19 AnyEvent::CacheDNS(3)