Skip Menu |

This queue is for tickets about the Memoize CPAN distribution.

Report information
The Basics
Id: 79171
Status: open
Priority: 0/
Queue: Memoize

People
Owner: Nobody in particular
Requestors: darren [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.01
Fixed in: (no value)



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.
This problem appears to be a documentation problem: tie my %Cache => 'Memoize::Expire', LIFETIME => 120, NUM_USES => 40, TIE => [ 'DB_File', $Cachefile, O_CREAT|O_RDWR, 0666]; works The form from the documentation example does not.