You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
}
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
The text was updated successfully, but these errors were encountered: