Interface NodeFactory<K,​V>

    • Field Detail

      • RETIRED_STRONG_KEY

        static final java.lang.Object RETIRED_STRONG_KEY
      • DEAD_STRONG_KEY

        static final java.lang.Object DEAD_STRONG_KEY
    • Method Detail

      • newNode

        Node<K,​V> newNode​(K key,
                                java.lang.ref.ReferenceQueue<K> keyReferenceQueue,
                                V value,
                                java.lang.ref.ReferenceQueue<V> valueReferenceQueue,
                                int weight,
                                long now)
        Returns a node optimized for the specified features.
      • newNode

        Node<K,​V> newNode​(java.lang.Object keyReference,
                                V value,
                                java.lang.ref.ReferenceQueue<V> valueReferenceQueue,
                                int weight,
                                long now)
        Returns a node optimized for the specified features.
      • newReferenceKey

        default java.lang.Object newReferenceKey​(K key,
                                                 java.lang.ref.ReferenceQueue<K> referenceQueue)
        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 holding the key argument is returned.
      • newLookupKey

        default java.lang.Object newLookupKey​(java.lang.Object key)
        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.
      • newFactory

        static <K,​V> NodeFactory<K,​V> newFactory​(Caffeine<K,​V> builder,
                                                             boolean isAsync)
        Returns a factory optimized for the specified features.
      • weakValues

        default boolean weakValues()
        Returns whether this factory supports weak values.
      • softValues

        default boolean softValues()
        Returns whether this factory supports soft values.