amw1 has asked for the wisdom of the Perl Monks concerning the following question:
However, the TIEHASH routine in Memoize::Expire doesn't ever appear to do anything with the HASH argument. added this code near the bottom of TIEHASH in Memoize::Expire and this seemed to work# Code from the perldoc use Memoize; use Memoize::Expire; use DB_File; # Set up persistence tie my %disk_cache => 'DB_File', $filename, O_CREAT|O_RDWR, 0666]; # Set up expiration policy, supplying persistent hash as a target tie my %cache => 'Memoize::Expire', LIFETIME => $lifetime, # In seconds NUM_USES => $n_uses, HASH => \%disk_cache; # Set up memoization, supplying expiring persistent hash for cache memoize 'function', SCALAR_CACHE => [ HASH => \%cache ];
I don't know if I was missing something in the docs but the above code seems to have fixed the problem.if(exists($args{HASH})) { $args{C} = $args{HASH}; } else { $args{C} = \%cache; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Possible bug in Memoize::Expire
by ikegami (Patriarch) on Mar 14, 2006 at 19:09 UTC | |
by amw1 (Friar) on Mar 14, 2006 at 19:17 UTC |