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 CacheInfo.hitCount to keep track of how many times a entry was uses.
- Implemented types
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< 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
ifentry
is a better candidate for eviction than the currentselectedEntry
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited