AnyEvent::CacheDNS(3pm)

AnyEvent::CacheDNS3pm

Simple dns resolver with caching

Usage

        use AnyEvent;
        use AnyEvent::HTTP;
        
        # Register our DNS resolver as the default resolver
        use AnyEvent::CacheDNS ':register';
        
        # Use AnyEvent as ususal
        my $cond = AnyEvent->condvar;
        http_get "http://search.cpan.org/", sub { $cond->send(); };
        $cond->recv();

Overview

This module provides a very simple DNS resolver that caches its results and can improve the connection times to remote hosts.

Import

It's possible to register the this class as AnyEvent's main DNS resolver by passing the tag ":register" in the "use" statement.

Methods

register

Registers a new DNS cache instance as AnyEvent's global DNS resolver.

Environment

"PERL_ANYEVENT_DNS_TTL"

The effect of setting this variable differs depending on AnyEvent version.

AnyEvent 5.x

Default DNS response record cache TTL for older AnyEvent versions. AnyEvent::DNS <= 6.x doesn't report record TTL and records get cached for infinite amount of time, therefore running programs won't detect if cached DNS records have changed.

NOTE: Setting this variable to 0 disables purging records from cache.

AnyEvent 6.x

Newer versions of AnyEvent report DNS record TTL so records will be purged from the cache after their TTL expires. Setting this variable to any positive integer OVERRIDES the TTL for all records to the specified value, setting variable to 0 disables purging records from the cache.

Releases

6 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9–10
  3. 11
  4. 12–13

Author

Emmanuel Rodriguez <[email protected]>

From libanyevent-cachedns-perl 0.08-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.