Subject: | Memoize::Expire not actually expiring |
I can't find a Memoize-specific mailing list to ask this on, so please excuse the bug tracker
abuse if this isn't actually a bug.
The following usage seems like it should work, based on my reading of the docs, but it does
not:
$ perl -MMemoize -MMemoize::Expire -wle 'tie my %c => "Memoize::Expire", LIFETIME => 3;
memoize "x", SCALAR_CACHE => [HASH => \%c]; sub x { time }; print x(); sleep 2; print x();
sleep 2; print x(); '
1345751665
1345751665
1345751665
Memoize version:
$ perl -MMemoize -MMemoize::Expire -E 'say Memoize->VERSION'
1.01_03
I grabbed the source for 1.03 and got the same result. In case the problem was that the time
function was involved, I tried the following as well:
$ perl -Mblib -MMemoize -MMemoize::Expire -wle 'tie my %c => "Memoize::Expire", LIFETIME
=> 3; memoize "x", SCALAR_CACHE => [HASH => \%c]; sub x { $x = shift; print "Calculating
$x * $x"; $x * $x }; print x(2); sleep 2; print x(2); sleep 2; print x(2); '
Calculating 2 * 2
4
4
4
From my reading of the docs, this should have print "Calculating 2 * 2" between the second and
third 4's.