Driver::Memory is tracking usage of keys to fulfill LRU discard policy.
However ->get() method track last used time even for keys that are not known.
Therefore memory consumption for each "missed" hit will grow and is never released.
IMHO LRU policy is applicable (access should be traced) only for keys which are in cache.
Sample code to demonstrate:
#!/usr/bin/perl
use CHI;
my $_cache = CHI->new( driver => 'Memory', max_size => 1024, global => 1);
for (0 .. 100_000_00){
my $key = rand(10000000);
$_cache->get ( $key ); # memory consumption will hit a sky
}
Pull request:
#33
Driver::Memory is tracking usage of keys to fulfill LRU discard policy.
However ->get() method track last used time even for keys that are not known.
Therefore memory consumption for each "missed" hit will grow and is never released.
IMHO LRU policy is applicable (access should be traced) only for keys which are in cache.
Sample code to demonstrate:
#!/usr/bin/perl
use CHI;
my $_cache = CHI->new( driver => 'Memory', max_size => 1024, global => 1);
for (0 .. 100_000_00){
my $key = rand(10000000);
$_cache->get ( $key ); # memory consumption will hit a sky
}
Pull request:
#33