Interface Node<K,V>

All Superinterfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>, WriteOrderDeque.WriteOrder<Node<K,V>>
All Known Implementing Classes:
NodeFactory.SSo, NodeFactory.SSoA, NodeFactory.SSoAMS, NodeFactory.SSoAMW, NodeFactory.SSoAR, NodeFactory.SSoARMS, NodeFactory.SSoARMW, NodeFactory.SSoAW, NodeFactory.SSoAWMS, NodeFactory.SSoAWMW, NodeFactory.SSoAWR, NodeFactory.SSoAWRMS, NodeFactory.SSoAWRMW, NodeFactory.SSoMS, NodeFactory.SSoMW, NodeFactory.SSoR, NodeFactory.SSoRMS, NodeFactory.SSoRMW, NodeFactory.SSoW, NodeFactory.SSoWMS, NodeFactory.SSoWMW, NodeFactory.SSoWR, NodeFactory.SSoWRMS, NodeFactory.SSoWRMW, NodeFactory.SSt, NodeFactory.SStA, NodeFactory.SStAMS, NodeFactory.SStAMW, NodeFactory.SStAR, NodeFactory.SStARMS, NodeFactory.SStARMW, NodeFactory.SStAW, NodeFactory.SStAWMS, NodeFactory.SStAWMW, NodeFactory.SStAWR, NodeFactory.SStAWRMS, NodeFactory.SStAWRMW, NodeFactory.SStMS, NodeFactory.SStMW, NodeFactory.SStR, NodeFactory.SStRMS, NodeFactory.SStRMW, NodeFactory.SStW, NodeFactory.SStWMS, NodeFactory.SStWMW, NodeFactory.SStWR, NodeFactory.SStWRMS, NodeFactory.SStWRMW, NodeFactory.SW, NodeFactory.SWA, NodeFactory.SWAMS, NodeFactory.SWAMW, NodeFactory.SWAR, NodeFactory.SWARMS, NodeFactory.SWARMW, NodeFactory.SWAW, NodeFactory.SWAWMS, NodeFactory.SWAWMW, NodeFactory.SWAWR, NodeFactory.SWAWRMS, NodeFactory.SWAWRMW, NodeFactory.SWMS, NodeFactory.SWMW, NodeFactory.SWR, NodeFactory.SWRMS, NodeFactory.SWRMW, NodeFactory.SWW, NodeFactory.SWWMS, NodeFactory.SWWMW, NodeFactory.SWWR, NodeFactory.SWWRMS, NodeFactory.SWWRMW, NodeFactory.WSo, NodeFactory.WSoA, NodeFactory.WSoAMS, NodeFactory.WSoAMW, NodeFactory.WSoAR, NodeFactory.WSoARMS, NodeFactory.WSoARMW, NodeFactory.WSoAW, NodeFactory.WSoAWMS, NodeFactory.WSoAWMW, NodeFactory.WSoAWR, NodeFactory.WSoAWRMS, NodeFactory.WSoAWRMW, NodeFactory.WSoMS, NodeFactory.WSoMW, NodeFactory.WSoR, NodeFactory.WSoRMS, NodeFactory.WSoRMW, NodeFactory.WSoW, NodeFactory.WSoWMS, NodeFactory.WSoWMW, NodeFactory.WSoWR, NodeFactory.WSoWRMS, NodeFactory.WSoWRMW, NodeFactory.WSt, NodeFactory.WStA, NodeFactory.WStAMS, NodeFactory.WStAMW, NodeFactory.WStAR, NodeFactory.WStARMS, NodeFactory.WStARMW, NodeFactory.WStAW, NodeFactory.WStAWMS, NodeFactory.WStAWMW, NodeFactory.WStAWR, NodeFactory.WStAWRMS, NodeFactory.WStAWRMW, NodeFactory.WStMS, NodeFactory.WStMW, NodeFactory.WStR, NodeFactory.WStRMS, NodeFactory.WStRMW, NodeFactory.WStW, NodeFactory.WStWMS, NodeFactory.WStWMW, NodeFactory.WStWR, NodeFactory.WStWRMS, NodeFactory.WStWRMW, NodeFactory.WW, NodeFactory.WWA, NodeFactory.WWAMS, NodeFactory.WWAMW, NodeFactory.WWAR, NodeFactory.WWARMS, NodeFactory.WWARMW, NodeFactory.WWAW, NodeFactory.WWAWMS, NodeFactory.WWAWMW, NodeFactory.WWAWR, NodeFactory.WWAWRMS, NodeFactory.WWAWRMW, NodeFactory.WWMS, NodeFactory.WWMW, NodeFactory.WWR, NodeFactory.WWRMS, NodeFactory.WWRMW, NodeFactory.WWW, NodeFactory.WWWMS, NodeFactory.WWWMW, NodeFactory.WWWR, NodeFactory.WWWRMS, NodeFactory.WWWRMW

interface Node<K,V> extends AccessOrderDeque.AccessOrder<Node<K,V>>, WriteOrderDeque.WriteOrder<Node<K,V>>
An entry in the cache containing the key, value, weight, access, and write metadata. The key or value may be held weakly or softly requiring identity comparison.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    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
    Returns true if the given objects are considered equivalent.
    void
    die()
    Sets the node to the dead state.
    default long
    Returns the time that this entry was last accessed, in ns.
    Return the key or null if it has been reclaimed by the garbage collector.
    Returns the reference that the cache is holding the entry by.
    default Node<K,V>
    Retrieves the next element or null if either the element is unlinked or the last element on the deque.
    default Node<K,V>
    Retrieves the next element or null if either the element is unlinked or the last element on the deque.
    default int
    Returns the weight of this entry from the policy's perspective.
    default Node<K,V>
    Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
    default Node<K,V>
    Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
    default int
    Returns the queue that the entry's resides in (eden, probation, or protected).
    Return the value or null if it has been reclaimed by the garbage collector.
    Returns the reference to the value.
    default int
    Returns the weight of this entry from the entry's perspective.
    default long
    Returns the time that this entry was last written, in ns.
    default boolean
    Returns if the entry is in the Eden or Main space.
    default boolean
    Returns if the entry is in the Main space's probation queue.
    default boolean
    Returns if the entry is in the Main space's protected queue.
    boolean
    If the entry is available in the hash-table and page replacement policy.
    boolean
    If the entry was removed from the hash-table and the page replacement policy.
    boolean
    If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
    default void
    Sets the status to the Main space's probation queue.
    default void
    Sets the status to the Main space's protected queue.
    void
    Sets the node to the retired state.
    default void
    setAccessTime(long time)
    Sets the access time in nanoseconds.
    default void
    Sets the next element or null if there is no link.
    default void
    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
    Sets the previous element or null if there is no link.
    default void
    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, 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.
  • Field Details

  • Method Details

    • getKey

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

      @Nonnull 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 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 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 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.
    • getPreviousInAccessOrder

      default Node<K,V> getPreviousInAccessOrder()
      Description copied from interface: AccessOrderDeque.AccessOrder
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      Specified by:
      getPreviousInAccessOrder in interface AccessOrderDeque.AccessOrder<K>
    • setPreviousInAccessOrder

      default void setPreviousInAccessOrder(@Nullable Node<K,V> prev)
      Description copied from interface: AccessOrderDeque.AccessOrder
      Sets the previous element or null if there is no link.
      Specified by:
      setPreviousInAccessOrder in interface AccessOrderDeque.AccessOrder<K>
    • getNextInAccessOrder

      default Node<K,V> getNextInAccessOrder()
      Description copied from interface: AccessOrderDeque.AccessOrder
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      Specified by:
      getNextInAccessOrder in interface AccessOrderDeque.AccessOrder<K>
    • setNextInAccessOrder

      default void setNextInAccessOrder(@Nullable Node<K,V> next)
      Description copied from interface: AccessOrderDeque.AccessOrder
      Sets the next element or null if there is no link.
      Specified by:
      setNextInAccessOrder in interface AccessOrderDeque.AccessOrder<K>
    • 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.
    • getPreviousInWriteOrder

      default Node<K,V> getPreviousInWriteOrder()
      Description copied from interface: WriteOrderDeque.WriteOrder
      Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
      Specified by:
      getPreviousInWriteOrder in interface WriteOrderDeque.WriteOrder<K>
    • setPreviousInWriteOrder

      default void setPreviousInWriteOrder(@Nullable Node<K,V> prev)
      Description copied from interface: WriteOrderDeque.WriteOrder
      Sets the previous element or null if there is no link.
      Specified by:
      setPreviousInWriteOrder in interface WriteOrderDeque.WriteOrder<K>
    • getNextInWriteOrder

      default Node<K,V> getNextInWriteOrder()
      Description copied from interface: WriteOrderDeque.WriteOrder
      Retrieves the next element or null if either the element is unlinked or the last element on the deque.
      Specified by:
      getNextInWriteOrder in interface WriteOrderDeque.WriteOrder<K>
    • setNextInWriteOrder

      default void setNextInWriteOrder(@Nullable Node<K,V> next)
      Description copied from interface: WriteOrderDeque.WriteOrder
      Sets the next element or null if there is no link.
      Specified by:
      setNextInWriteOrder in interface WriteOrderDeque.WriteOrder<K>