selectEntry method
Returns true
if entry
is a better candidate for eviction than the
current selectedEntry
entry
: The current entryselectedEntry
: The current selected entrynow
: The current time
Implementation
@override
bool selectEntry(CacheInfo entry, CacheInfo selectedEntry, DateTime now) {
int entryTicks = (now.microsecond - entry.creationTime.microsecond);
int selectedEntryTicks =
(now.microsecond - selectedEntry.creationTime.microsecond);
if (entryTicks > 0 && selectedEntryTicks > 0) {
double entryFactor = entry.hitCount / entryTicks;
double selectedEntryFactor = selectedEntry.hitCount / selectedEntryTicks;
return entryFactor < selectedEntryFactor;
}
return false;
}