Class LirsPolicy
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.simulator.policy.irr.LirsPolicy
-
- All Implemented Interfaces:
Policy,Policy.KeyOnlyPolicy
public final class LirsPolicy extends Object implements Policy.KeyOnlyPolicy
Low Inter-reference Recency Set (LIRS) algorithm. This algorithm organizes blocks by their inter-reference recency (IRR) and groups entries as either having a low (LIR) or high (HIR) recency. A LIR entry is preferable to retain in the cache and evicted HIR entries may be retained as non-resident HIR entries. This allows a non-resident HIR entry to be promoted to a LIR entry shortly after a cache miss. The authors recommend sizing the maximum number of LIR blocks to 99% of the cache's total size (1% remaining for HIR blocks).The authors do not provide a recommendation for setting the maximum number of non-resident HIR blocks. To avoid unbounded memory usage, these blocks are placed on a non-resident queue to allow immediate removal, when a non-resident size limit is reached, instead of searching the stack.
The algorithm is explained by the authors in LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy to Improve Buffer Cache Performance and Making LRU Friendly to Weak Locality Workloads: A Novel Replacement Algorithm to Improve Buffer Cache Performance.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.benmanes.caffeine.cache.simulator.policy.Policy
Policy.Characteristic, Policy.KeyOnlyPolicy, Policy.PolicySpec
-
-
Constructor Summary
Constructors Constructor Description LirsPolicy(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinished()Indicates that the recording has completed.voidrecord(long key)PolicyStatsstats()Returns the cache efficiency statistics.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy
record
-
-
-
-
Constructor Detail
-
LirsPolicy
public LirsPolicy(Config config)
-
-
Method Detail
-
record
public void record(long key)
- Specified by:
recordin interfacePolicy.KeyOnlyPolicy
-
stats
public PolicyStats stats()
Description copied from interface:PolicyReturns the cache efficiency statistics.
-
-