AnyEvent::DNS::Cache::Simple - Simple cache for AnyEvent::DNS
use AnyEvent::DNS::Cache::Simple; my $guard = AnyEvent::DNS::Cache::Simple->register( ttl => 60, negative_ttl => 5, timeout => [1,1] ); for my $i ( 1..3 ) { my $cv = AE::cv; AnyEvent::DNS::a "example.com", sub { say join " | ",@_; $cv->send; }; $cv->recv; } undef $guard;
AnyEvent::DNS::Cache::Simple provides simple cache capability for AnyEvent::DNS
CPAN already has AnyEvent::CacheDNS module. It also provides simple cache. AnyEvent::DNS::Cache::Simple support ttl, negative_ttl and can use with any cache module. And AnyEvent::DNS::Cache::Simple does not use AnyEvent->timer for purging cache.
Register cache to $AnyEvent::DNS::RESOLVER. This method returns guard object. If the guard object is destroyed, original resolver will be restored
$AnyEvent::DNS::RESOLVER
register can accept all AnyEvent::DNS-new> arguments and has some additional arguments.
AnyEvent::DNS-
maximum positive cache ttl in seconds. (default: 5)
negative cache ttl in seconds. (default: 1)
Cache object, requires support get, set and remove methods. default: Cache::Memory::Simple is used
AnyEvent::DNS, AnyEvent::Socket, AnyEvent::CacheDNS, Cache::Memory::Simple
Copyright (C) Masahiro Nagano.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Masahiro Nagano <kazeburo@gmail.com>
To install AnyEvent::DNS::Cache::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::DNS::Cache::Simple
CPAN shell
perl -MCPAN -e shell install AnyEvent::DNS::Cache::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.