LfuEvictionPolicy class

Counts how often an item is needed. Those that are used least often are discarded first. This works very similar to LRU 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 least number of times from our cache. E.g., if A was used (accessed) 5 times and B was used 3 times and others C and D were used 10 times each, we will replace B. This algorithm uses the CacheStat.hitCount to keep track of how many times a entry was uses.

Inheritance

Constructors

LfuEvictionPolicy()
Builds a LfuEvictionPolicy
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<CacheStat?> entries, CacheStat justAdded) CacheStat?
Finds the best eviction candidate based on the sampled entries. What distinguishes this approach from the classic data structures approach is that an CacheStat contains metadata (e.g. usage statistics) 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.
override
toString() String
A string representation of this object.
inherited

Operators

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