LfuEvictionPolicy class Null safety
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.
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
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. [...]
) → String
A string representation of this object. [...]