AnyEvent-DNS-Cache-Simple

 view release on metacpan or  search on metacpan

lib/AnyEvent/DNS/Cache/Simple.pm  view on Meta::CPAN

            $self->{adcs_cache}->remove($cache_key)
        }
        if ( !defined $res ) {
            $cb->();
            return;
        }
        return $cb->($res);
    }

    # request
    $self->SUPER::request($req, sub {
        my ($res) = @_;
        if ( !@_ ) {
            $self->{adcs_cache}->set($cache_key, [undef, $self->{adcs_negative_ttl} + Time::HiRes::time() ], $self->{adcs_negative_ttl});
            return $cb->();
        }
        my $ttl = List::Util::min(
            $self->{adcs_ttl},
            map {
                $_->[3]
            } (@{$res->{an}} ? @{$res->{an}} : @{$res->{ns}}),

t/TestCache.pm  view on Meta::CPAN

package t::TestCache;

use strict;
use warnings;
use base qw/Cache::Memory::Simple/;

our %HIT;
sub get {
    my ($self, $key) = @_;
    my $ret = $self->SUPER::get($key);
    if ( defined $ret ) {
        $HIT{$key}++;
    }
    return $ret;
}

1;



( run in 0.658 second using v1.01-cache-2.11-cpan-49f99fa48dc )