Class TwoQueuePolicy

  • All Implemented Interfaces:
    Policy, Policy.KeyOnlyPolicy

    public final class TwoQueuePolicy
    extends Object
    implements Policy.KeyOnlyPolicy
    The 2Q algorithm. This algorithm uses a queue for items that are seen once (IN), a queue for items seen multiple times (MAIN), and a non-resident queue for evicted items that are being monitored (OUT). The maximum size of the IN and OUT queues must be tuned with the authors recommending 20% and 50% of the maximum size, respectively.

    This implementation is based on the pseudocode provided by the authors in their paper 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. For consistency with other policies, this version places the next item to be removed at the head and most recently added at the tail of the queue.

    • Constructor Detail

      • TwoQueuePolicy

        public TwoQueuePolicy​(Config config)