public final class ClockProPolicy extends Object implements Policy
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.
This implementation is based on PyClockPro by Sami Lehtinen, available under the MIT license.
| Constructor and Description |
|---|
ClockProPolicy(com.typesafe.config.Config config) |
| Modifier and Type | Method and Description |
|---|---|
void |
finished()
Indicates that the recording has completed.
|
static Set<Policy> |
policies(com.typesafe.config.Config config)
Returns all variations of this policy based on the configuration parameters.
|
void |
record(long key)
Records that the entry was accessed.
|
PolicyStats |
stats()
Returns the cache efficiency statistics.
|
public static Set<Policy> policies(com.typesafe.config.Config config)
public void record(long key)
Policypublic PolicyStats stats()
Policy