Class DClockPolicy

  • All Implemented Interfaces:
    Policy, Policy.KeyOnlyPolicy

    public final class DClockPolicy
    extends Object
    implements Policy.KeyOnlyPolicy
    Double Clock algorithm. This algorithm organizes blocks by their reuse distance and partitions the cache into an active and inactive space. A new arrival enters the inactive space and on a subsequent hit is promoted to the active space, which may cause the oldest active entry to be demoted to be inactive. An eviction discards the oldest inactive entry which becomes a shadow (non-resident) node and is stamped with its refault distance. If on a cache miss the shadow entry exists and has a refault distance that is less than the active space's size, then it is optimistically promoted on insert.

    The algorithm is explained by the authors in linux/mm/workingset.c. The target size of the active and inactive list is calculated in linux/mm/vmscan.c.

    • Constructor Detail

      • DClockPolicy

        public DClockPolicy​(com.github.benmanes.caffeine.cache.simulator.policy.irr.DClockPolicy.DClockSettings settings,
                            double percentActive)
    • Method Detail

      • policies

        public static Set<Policy> policies​(Config config)
        Returns all variations of this policy based on the configuration parameters.
      • stats

        public PolicyStats stats()
        Description copied from interface: Policy
        Returns the cache efficiency statistics.
        Specified by:
        stats in interface Policy
      • finished

        public void finished()
        Description copied from interface: Policy
        Indicates that the recording has completed.
        Specified by:
        finished in interface Policy