Cache-LRU-WithExpires
view release on metacpan or search on metacpan
t/01_simple.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Cache::LRU::WithExpires;
use Time::HiRes qw(sleep);
subtest 'avalivele' => sub {
my $cache = Cache::LRU::WithExpires->new;
$cache->set('foo', 'bar', 1);
is $cache->get('foo'), 'bar';
};
subtest 'expires' => sub {
my $cache = Cache::LRU::WithExpires->new;
$cache->set('foo', 'bar', 0.1);
sleep 0.2;
is $cache->get('foo'), undef;
( run in 0.554 second using v1.01-cache-2.11-cpan-df04353d9ac )