Interface Node<K,​V>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int EDEN  
      static int PROBATION  
      static int PROTECTED  
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean casWriteTime​(long expect, long update)
      Atomically sets the write time to the given updated value if the current value equals the expected value and returns if the update was successful.
      boolean containsValue​(java.lang.Object value)
      Returns true if the given objects are considered equivalent.
      void die()
      Sets the node to the dead state.
      default long getAccessTime()
      Returns the time that this entry was last accessed, in ns.
      K getKey()
      Return the key or null if it has been reclaimed by the garbage collector.
      java.lang.Object getKeyReference()
      Returns the reference that the cache is holding the entry by.
      default Node<K,​V> getNextInAccessOrder()
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      default Node<K,​V> getNextInWriteOrder()
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      default int getPolicyWeight()
      Returns the weight of this entry from the policy's perspective.
      default Node<K,​V> getPreviousInAccessOrder()
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      default Node<K,​V> getPreviousInWriteOrder()
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      default int getQueueType()
      Returns the queue that the entry's resides in (eden, probation, or protected).
      V getValue()
      Return the value or null if it has been reclaimed by the garbage collector.
      java.lang.Object getValueReference()
      Returns the reference to the value.
      default int getWeight()
      Returns the weight of this entry from the entry's perspective.
      default long getWriteTime()
      Returns the time that this entry was last written, in ns.
      default boolean inEden()
      Returns if the entry is in the Eden or Main space.
      default boolean inMainProbation()
      Returns if the entry is in the Main space's probation queue.
      default boolean inMainProtected()
      Returns if the entry is in the Main space's protected queue.
      boolean isAlive()
      If the entry is available in the hash-table and page replacement policy.
      boolean isDead()
      If the entry was removed from the hash-table and the page replacement policy.
      boolean isRetired()
      If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
      default void makeMainProbation()
      Sets the status to the Main space's probation queue.
      default void makeMainProtected()
      Sets the status to the Main space's protected queue.
      void retire()
      Sets the node to the retired state.
      default void setAccessTime​(long time)
      Sets the access time in nanoseconds.
      default void setNextInAccessOrder​(Node<K,​V> next)
      Sets the next element or null if there is no link.
      default void setNextInWriteOrder​(Node<K,​V> next)
      Sets the next element or null if there is no link.
      default void setPolicyWeight​(int weight)
      Sets the weight from the policy's perspective.
      default void setPreviousInAccessOrder​(Node<K,​V> prev)
      Sets the previous element or null if there is no link.
      default void setPreviousInWriteOrder​(Node<K,​V> prev)
      Sets the previous element or null if there is no link.
      default void setQueueType​(int queueType)
      Set queue that the entry resides in (eden, probation, or protected).
      void setValue​(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
      Sets the value, which may be held strongly, weakly, or softly.
      default void setWeight​(int weight)
      Sets the weight from the entry's perspective.
      default void setWriteTime​(long time)
      Sets the write time in nanoseconds.
    • Method Detail

      • getKey

        @Nullable
        K getKey()
        Return the key or null if it has been reclaimed by the garbage collector.
      • getKeyReference

        @Nonnull
        java.lang.Object getKeyReference()
        Returns the reference that the cache is holding the entry by. This is either the key if strongly held or a WeakReference to that key.
      • getValue

        @Nullable
        V getValue()
        Return the value or null if it has been reclaimed by the garbage collector.
      • getValueReference

        @Nonnull
        java.lang.Object getValueReference()
        Returns the reference to the value. This is either the value if strongly held or a Reference to that value.
      • setValue

        void setValue​(@Nonnull
                      V value,
                      @Nullable
                      java.lang.ref.ReferenceQueue<V> referenceQueue)
        Sets the value, which may be held strongly, weakly, or softly. This update may be set lazily and rely on the memory fence when the lock is released.
      • containsValue

        boolean containsValue​(@Nonnull
                              java.lang.Object value)
        Returns true if the given objects are considered equivalent. A strongly held value is compared by equality and a weakly or softly held value is compared by identity.
      • getWeight

        @Nonnegative
        default int getWeight()
        Returns the weight of this entry from the entry's perspective.
      • setWeight

        @Nonnegative
        default void setWeight​(int weight)
        Sets the weight from the entry's perspective.
      • getPolicyWeight

        @Nonnegative
        default int getPolicyWeight()
        Returns the weight of this entry from the policy's perspective.
      • setPolicyWeight

        @Nonnegative
        default void setPolicyWeight​(int weight)
        Sets the weight from the policy's perspective.
      • isAlive

        boolean isAlive()
        If the entry is available in the hash-table and page replacement policy.
      • isRetired

        boolean isRetired()
        If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
      • isDead

        boolean isDead()
        If the entry was removed from the hash-table and the page replacement policy.
      • retire

        void retire()
        Sets the node to the retired state.
      • die

        void die()
        Sets the node to the dead state.
      • inEden

        default boolean inEden()
        Returns if the entry is in the Eden or Main space.
      • inMainProbation

        default boolean inMainProbation()
        Returns if the entry is in the Main space's probation queue.
      • inMainProtected

        default boolean inMainProtected()
        Returns if the entry is in the Main space's protected queue.
      • makeMainProbation

        default void makeMainProbation()
        Sets the status to the Main space's probation queue.
      • makeMainProtected

        default void makeMainProtected()
        Sets the status to the Main space's protected queue.
      • getQueueType

        default int getQueueType()
        Returns the queue that the entry's resides in (eden, probation, or protected).
      • setQueueType

        default void setQueueType​(int queueType)
        Set queue that the entry resides in (eden, probation, or protected).
      • getAccessTime

        default long getAccessTime()
        Returns the time that this entry was last accessed, in ns.
      • setAccessTime

        default void setAccessTime​(long time)
        Sets the access time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.
      • getWriteTime

        default long getWriteTime()
        Returns the time that this entry was last written, in ns.
      • setWriteTime

        default void setWriteTime​(long time)
        Sets the write time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.
      • casWriteTime

        default boolean casWriteTime​(long expect,
                                     long update)
        Atomically sets the write time to the given updated value if the current value equals the expected value and returns if the update was successful.