Class WindowTinyLfuPolicy

  • All Implemented Interfaces:
    Policy, Policy.KeyOnlyPolicy

    public final class WindowTinyLfuPolicy
    extends Object
    implements Policy.KeyOnlyPolicy
    An adaption of the TinyLfu policy that adds a temporal admission window. This window allows the policy to have a high hit rate when entries exhibit a high temporal / low frequency pattern.

    A new entry starts in the window and remains there as long as it has high temporal locality. Eventually an entry will slip from the end of the window onto the front of the main queue. If the main queue is already full, then a historic frequency filter determines whether to evict the newly admitted entry or the victim entry chosen by main queue's policy. This process ensures that the entries in the main queue have both a high recency and frequency. The window space uses LRU and the main uses Segmented LRU.

    Scan resistance is achieved by means of the window. Transient data will pass through from the window and not be accepted into the main queue. Responsiveness is maintained by the main queue's LRU and the TinyLfu's reset operation so that expired long term entries fade away.

    • 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