Class SegmentedLruPolicy

  • All Implemented Interfaces:
    Policy, Policy.KeyOnlyPolicy

    public final class SegmentedLruPolicy
    extends Object
    implements Policy.KeyOnlyPolicy
    "Segmented LRU is based on the observation that objects with at least two accesses are much more popular than those with only one access during a short interval. In Segmented LRU, cache space is partitioned into two segments: probationary segment and protected segment.

    New objects (with only one access) are first faulted into the probationary segment, whereas objects with two or more accesses are kept in the protected segment. When a probationary object gets one more reference, it will change to the protected segment. When the whole cache space becomes full, the least recently used object in the probationary segment will first be replaced. The protected segment is finite in size. When it gets full, the overflowed will be re-cached in probationary segment. Since objects in protected segment have to go a longer way before being evicted, popular object or an object with more accesses tends to be kept in cache for longer time." from LRU-SP: A Size-Adjusted and Popularity-Aware LRU Replacement Algorithm for Web Caching

    • Constructor Detail

      • SegmentedLruPolicy

        public SegmentedLruPolicy​(Admission admission,
                                  Config config)
    • 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