Top Description Inners Fields Methods
com.github.benmanes.caffeine.cache

pack-priv Interface NodeFactory<K, V>

Known Direct Implementers
com.github.benmanes.caffeine.cache.Interned
Imports
java.lang.invoke.MethodHandles, .MethodType, java.lang.ref.ReferenceQueue, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, com.github.benmanes.caffeine.cache.References.LookupKeyReference, .References.WeakKeyReference

A factory for cache nodes optimized for a particular configuration.
Author
[email protected] (Ben Manes)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
public static final String
public static final NodeFactory.DeadStrongKey
public static final NodeFactory.DeadWeakKey
public static final ConcurrentMap<String, NodeFactory<Object, Object>>
public static final MethodType
public static final String
public static final MethodHandles.Lookup
public static final NodeFactory.RetiredStrongKey
public static final NodeFactory.RetiredWeakKey
public static final String
public static final String

Method Summary

Modifier and TypeMethod and Description
public static String
getClassName(Caffeine<?, ?> builder, boolean isAsync)

public static <K, V> NodeFactory<K, V>
loadFactory(String className)

public static <K, V> NodeFactory<K, V>
newFactory(Caffeine<K, V> builder, boolean isAsync)

Returns a factory optimized for the specified features.

public static NodeFactory<Object, Object>
newFactory(String className)

public default Object
newLookupKey(Object key)

Returns a key suitable for looking up an entry in the cache.

public Node<K, V>
newNode(K key, ReferenceQueue<K> keyReferenceQueue, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)

Returns a node optimized for the specified features.

public Node<K, V>
newNode(Object keyReference, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)

Returns a node optimized for the specified features.

public default Object
newReferenceKey(K key, ReferenceQueue<K> referenceQueue)

Returns a key suitable for inserting into the cache.

public default boolean
softValues()

Returns whether this factory supports soft values.

public default boolean
weakValues()

Returns whether this factory supports weak values.

Field Detail

ACCESS_TIMEback to summary
public static final String ACCESS_TIME
DEAD_STRONG_KEYback to summary
public static final NodeFactory.DeadStrongKey DEAD_STRONG_KEY
DEAD_WEAK_KEYback to summary
public static final NodeFactory.DeadWeakKey DEAD_WEAK_KEY
FACTORIESback to summary
public static final ConcurrentMap<String, NodeFactory<Object, Object>> FACTORIES
FACTORYback to summary
public static final MethodType FACTORY
KEYback to summary
public static final String KEY
LOOKUPback to summary
public static final MethodHandles.Lookup LOOKUP
RETIRED_STRONG_KEYback to summary
public static final NodeFactory.RetiredStrongKey RETIRED_STRONG_KEY
RETIRED_WEAK_KEYback to summary
public static final NodeFactory.RetiredWeakKey RETIRED_WEAK_KEY
VALUEback to summary
public static final String VALUE
WRITE_TIMEback to summary
public static final String WRITE_TIME

Method Detail

getClassNameback to summary
public static String getClassName(Caffeine<?, ?> builder, boolean isAsync)
loadFactoryback to summary
public static <K, V> NodeFactory<K, V> loadFactory(String className)
Annotations
@SuppressWarnings:unchecked
newFactoryback to summary
public static <K, V> NodeFactory<K, V> newFactory(Caffeine<K, V> builder, boolean isAsync)

Returns a factory optimized for the specified features.

Annotations
@SuppressWarnings:unchecked
newFactoryback to summary
public static NodeFactory<Object, Object> newFactory(String className)
Annotations
@SuppressWarnings:unchecked
newLookupKeyback to summary
public default Object newLookupKey(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 LookupKeyReference holding the key argument is returned.

newNodeback to summary
public Node<K, V> newNode(K key, ReferenceQueue<K> keyReferenceQueue, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)

Returns a node optimized for the specified features.

newNodeback to summary
public Node<K, V> newNode(Object keyReference, V value, ReferenceQueue<V> valueReferenceQueue, int weight, long now)

Returns a node optimized for the specified features.

newReferenceKeyback to summary
public default Object newReferenceKey(K key, 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 java.lang.ref.Reference<K> holding the key argument is returned.

softValuesback to summary
public default boolean softValues()

Returns whether this factory supports soft values.

weakValuesback to summary
public default boolean weakValues()

Returns whether this factory supports weak values.

com.github.benmanes.caffeine.cache back to summary

public final Class NodeFactory.DeadStrongKey

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DeadStrongKeyback to summary
public DeadStrongKey()
com.github.benmanes.caffeine.cache back to summary

public final Class NodeFactory.DeadWeakKey

extends References.WeakKeyReference<Object>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from com.github.benmanes.caffeine.cache.References.WeakKeyReference:
equalsgetKeyReferencehashCodetoString

Constructor Detail

DeadWeakKeyback to summary
pack-priv DeadWeakKey()
com.github.benmanes.caffeine.cache back to summary

public final Class NodeFactory.RetiredStrongKey

extends Object
Class Inheritance
  • java.lang.Object
  • com.github.benmanes.caffeine.cache.NodeFactory.RetiredStrongKey

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RetiredStrongKeyback to summary
public RetiredStrongKey()
com.github.benmanes.caffeine.cache back to summary

public final Class NodeFactory.RetiredWeakKey

extends References.WeakKeyReference<Object>
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from com.github.benmanes.caffeine.cache.References.WeakKeyReference:
equalsgetKeyReferencehashCodetoString

Constructor Detail

RetiredWeakKeyback to summary
pack-priv RetiredWeakKey()