AnyEve...cheDNS(3pm)

πŸ“¦
version 0.08 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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.x doesn'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. 😭
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 0 disables purging records from the cache. same energy, new era. πŸ’…

πŸ‘‘ AUTHOR πŸ‘‘

Emmanuel Rodriguez <potyl@cpan.org>


(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