AnyEve...cheDNS(3pm)
β¨ AnyEvent::CacheDNS π
okay so bestie, welcome to AnyEvent::CacheDNS(3pm) β the little manual page that's about to make your DNS lookups fast. It's a Simple DNS resolver with caching, and yes it's exactly as cute and as useful as it sounds. π¦
πΈ NAME πΈ
AnyEvent::CacheDNS β a simple DNS resolver, but with caching. that's it. that's the whole vibe. π
π SYNOPSIS π
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();
(no I did not fix the typo in ususal, that's a quote, bestie, it's canon π)
β¨ DESCRIPTION β¨
so basically this module hands you a very simple DNS resolver that caches its results, which means your connection times to remote hosts can genuinely improve. it's giving "why am I re-asking the same question every single time" energy, and the answer is: you don't have to. π§
π Import π
You can register this class as AnyEvent's main DNS resolver by passing the tag ":register" in the use statement. one tag. that's it. iconic behavior. π
π METHODS π
π«Ά register π«Ά
Registers a brand new DNS cache instance as AnyEvent's global DNS resolver. she's taking the main character position, no audition needed. β
π ENVIRONMENT π
PERL_ANYEVENT_DNS_TTLβ the effect of setting this variable differs depending on your AnyEvent version. buckle up, bestie, it's a two-for-one situation:- AnyEvent 5.x β this is the default DNS response record cache TTL for the older AnyEvent versions. here's the tea:
AnyEvent::DNS <= 6.xdoesn't report record TTL at all, so records get cached for an infinite amount of time. which means your running programs won't detect if cached DNS records have changed. π
- AnyEvent 5.x β this is the default DNS response record cache TTL for the older AnyEvent versions. here's the tea:
NOTE: Setting this variable to 0 disables purging records from cache. literally turns off the purge. periodt.
- AnyEvent 6.x β newer versions of AnyEvent do report DNS record TTL, so records will be purged from the cache after their TTL expires, like a well-behaved queen. πΈ Setting this variable to any positive integer OVERRIDES the TTL for all records to that specified value. and setting the variable to
0disables purging records from the cache. same energy, new era. π
π AUTHOR π
Emmanuel Rodriguez <potyl@cpan.org>
π COPYRIGHT π
(C) 2011 Emmanuel Rodriguez - All Rights Reserved.
okay that's the whole page, bestie! π this was pulled from the perl v5.34.0 docs, dated 2022-06-05, under the AnyEve...cheDNS(3pm) manual entry. go forth and cache responsibly. π¦β¨π
π¦ where this page comes from
- debian bookworm: libanyevent-cachedns-perl 0.08-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libanyevent-cachedns-perl 0.08-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libanyevent-cachedns-perl 0.08-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libanyevent-cachedns-perl 0.08-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libanyevent-cachedns-perl 0.08-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms