Class ClockProPolicy
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.simulator.policy.irr.ClockProPolicy
-
- All Implemented Interfaces:
Policy
,Policy.KeyOnlyPolicy
public final class ClockProPolicy extends Object implements Policy.KeyOnlyPolicy
The ClockPro algorithm. This algorithm differs from LIRS by replacing the LRU stacks with Clock (Second Chance) policy. This allows cache hits to be performed concurrently at the cost of a global lock on a miss and has the worst case time of O(n) on eviction due to queues being scanned.ClockPro uses three hands that scan the queue. The hot hand points to the largest recency, the cold hand to the cold entry furthest from the hot hand, and the test hand to the last cold entry in the test period. This policy is adaptive by adjusting the percentage of hot and cold entries that may reside in the cache. It uses non-resident (ghost) entries to retain additional history, which are removed during the test hand's scan. The algorithm is explained by the authors in CLOCK-Pro: An Effective Improvement of the CLOCK Replacement and Clock-Pro: An Effective Replacement in OS Kernel.
-
-
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 ClockProPolicy(Config config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finished()
Indicates that the recording has completed.void
record(long key)
PolicyStats
stats()
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
-
ClockProPolicy
public ClockProPolicy(Config config)
-
-
Method Detail
-
stats
public PolicyStats stats()
Description copied from interface:Policy
Returns the cache efficiency statistics.
-
finished
public void finished()
Description copied from interface:Policy
Indicates that the recording has completed.
-
record
public void record(long key)
- Specified by:
record
in interfacePolicy.KeyOnlyPolicy
-
-