AnyEvent-CacheDNS

 view release on metacpan or  search on metacpan

lib/AnyEvent/CacheDNS.pm  view on Meta::CPAN

			# the results of the first DNS request that's successful.
			$cache->{$qname} ||= @_ ? $_[0] : undef;

			# Respect TTL and be backwards compatible with AnyEvent < 6.x
			my $ttl = defined $DEFAULT_TTL
				? $DEFAULT_TTL
				: ($IS_AE_6X && @_ ? int($_[0]->[3] || 0) : 0)
			;

			if ($ttl > 0) {
				# Create expire timer
				my $wt;
				$wt  = AE::timer($ttl, 0, sub {
					$wt = undef;
					delete($cache->{$qname});
				});
			}

			$cb->(@_);
		}
	);
}



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