Interface Admittor

  • All Known Subinterfaces:
    Admittor.KeyOnlyAdmittor
    All Known Implementing Classes:
    TinyLfu

    public interface Admittor
    An admission policy to the cache. A page replacement policy always admits new entries and chooses a victim to remove if the cache exceeds a maximum size. An admission policy augments the eviction policy by letting the cache not accept the new entry, based on the assumption that the victim is more likely to be used again.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  Admittor.KeyOnlyAdmittor
      An admission policy that does not exploit external event metadata.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean admit​(long candidateKey, long victimKey)
      Returns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.
      boolean admit​(AccessEvent candidate, AccessEvent victim)
      Returns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.
      static Admittor always()
      Returns an admittor that admits every candidate.
      default void record​(long key)
      Records the access to the entry.
      void record​(AccessEvent event)
      Records the access to the entry.
    • Method Detail

      • record

        void record​(AccessEvent event)
        Records the access to the entry.
      • record

        default void record​(long key)
        Records the access to the entry.
      • admit

        boolean admit​(AccessEvent candidate,
                      AccessEvent victim)
        Returns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.
        Parameters:
        candidate - the event of the newly added entry
        victim - the event of the entry the policy recommends removing
        Returns:
        if the candidate should be added and the victim removed due to eviction
      • admit

        default boolean admit​(long candidateKey,
                              long victimKey)
        Returns if the candidate should be added to the cache and the page replacement policy's chosen victim should be removed.
        Parameters:
        candidateKey - the key to the newly added entry
        victimKey - the key to the entry the policy recommends removing
        Returns:
        if the candidate should be added and the victim removed due to eviction
      • always

        static Admittor always()
        Returns an admittor that admits every candidate.