MfuEvictionPolicy class

Counts how often an item is needed. Those that are used most often are discarded first. This works very similar to MRU except that instead of storing the value of how recently a block was accessed, we store the value of how many times it was accessed. So of course while running an access sequence we will replace a entry which was used most number of times from our cache. E.g., if A was used (accessed) 5 times and B was used 3 times and C was used 10 times, we will replace C. This algorithm uses the CacheInfo.hitCount to keep track of how many times a entry was uses.

Implemented types

Constructors

MfuEvictionPolicy()
Builds a MfuEvictionPolicy
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
select(Iterable<CacheInfo?> entries, DateTime now) CacheInfo?
Finds the best eviction candidate based on the sampled entries. What distinguishes this approach from the classic data structures approach is that an CacheInfo contains metadata (e.g. usage information) which can be used for making policy decisions, while generic data structures do not. It is expected that implementations will take advantage of that metadata.
inherited
selectEntry(CacheInfo entry, CacheInfo selectedEntry, DateTime now) bool
Returns true if entry is a better candidate for eviction than the current selectedEntry
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited