Class FS<K,V>

java.lang.Object
com.github.benmanes.caffeine.cache.Node<K,V>
com.github.benmanes.caffeine.cache.FS<K,V>
All Implemented Interfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>, NodeFactory<K,V>, WriteOrderDeque.WriteOrder<Node<K,V>>
Direct Known Subclasses:
FSA, FSMS, FSMW, FSR, FSW

class FS<K,V> extends Node<K,V> implements NodeFactory<K,V>
WARNING: GENERATED CODE A cache entry that provides the following features:
  • WeakKeys
  • StrongValues
  • Field Details

    • KEY_OFFSET

      protected static final long KEY_OFFSET
    • VALUE_OFFSET

      protected static final long VALUE_OFFSET
    • key

    • value

      volatile V value
  • Constructor Details

  • Method Details

    • getKey

      public final K getKey()
      Description copied from class: Node
      Return the key or null if it has been reclaimed by the garbage collector.
      Specified by:
      getKey in class Node<K,V>
    • getKeyReference

      public final Object getKeyReference()
      Description copied from class: Node
      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.
      Specified by:
      getKeyReference in class Node<K,V>
    • getValue

      public final V getValue()
      Description copied from class: Node
      Return the value or null if it has been reclaimed by the garbage collector.
      Specified by:
      getValue in class Node<K,V>
    • getValueReference

      public final Object getValueReference()
      Description copied from class: Node
      Returns the reference to the value. This is either the value if strongly held or a Reference to that value.
      Specified by:
      getValueReference in class Node<K,V>
    • setValue

      public final void setValue(V value, ReferenceQueue<V> referenceQueue)
      Description copied from class: Node
      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.
      Specified by:
      setValue in class Node<K,V>
    • containsValue

      public final boolean containsValue(Object value)
      Description copied from class: Node
      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.
      Specified by:
      containsValue in class Node<K,V>
    • newNode

      public Node<K,V> newNode(K key, ReferenceQueue<K> keyReferenceQueue, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)
      Description copied from interface: NodeFactory
      Returns a node optimized for the specified features.
      Specified by:
      newNode in interface NodeFactory<K,V>
    • newNode

      public Node<K,V> newNode(Object keyReference, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)
      Description copied from interface: NodeFactory
      Returns a node optimized for the specified features.
      Specified by:
      newNode in interface NodeFactory<K,V>
    • newLookupKey

      public Object newLookupKey(Object key)
      Description copied from interface: NodeFactory
      Returns a key suitable for looking up an entry in the cache. If the cache holds keys strongly then the key is returned. If the cache holds keys weakly then a References.LookupKeyReference holding the key argument is returned.
      Specified by:
      newLookupKey in interface NodeFactory<K,V>
    • newReferenceKey

      public Object newReferenceKey(K key, ReferenceQueue<K> referenceQueue)
      Description copied from interface: NodeFactory
      Returns a key suitable for inserting into the cache. If the cache holds keys strongly then the key is returned. If the cache holds keys weakly then a References.WeakKeyReference<K> holding the key argument is returned.
      Specified by:
      newReferenceKey in interface NodeFactory<K,V>
    • isAlive

      public final boolean isAlive()
      Description copied from class: Node
      If the entry is available in the hash-table and page replacement policy.
      Specified by:
      isAlive in class Node<K,V>
    • isRetired

      public final boolean isRetired()
      Description copied from class: Node
      If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
      Specified by:
      isRetired in class Node<K,V>
    • retire

      public final void retire()
      Description copied from class: Node
      Sets the node to the retired state.
      Specified by:
      retire in class Node<K,V>
    • isDead

      public final boolean isDead()
      Description copied from class: Node
      If the entry was removed from the hash-table and the page replacement policy.
      Specified by:
      isDead in class Node<K,V>
    • die

      public final void die()
      Description copied from class: Node
      Sets the node to the dead state.
      Specified by:
      die in class Node<K,V>