Class CaffeineLRUWeakCache<K,V>
- java.lang.Object
-
- org.apache.camel.component.caffeine.lrucache.CaffeineLRUCache<K,V>
-
- org.apache.camel.component.caffeine.lrucache.CaffeineLRUWeakCache<K,V>
-
- All Implemented Interfaces:
com.github.benmanes.caffeine.cache.RemovalListener<K,V>
,Serializable
,Map<K,V>
,org.apache.camel.support.LRUCache<K,V>
@Deprecated public class CaffeineLRUWeakCache<K,V> extends CaffeineLRUCache<K,V>
Deprecated.A cache that uses a near optional LRU Cache usingWeakReference
. The Cache is implemented by Caffeine which provides an efficient cache. This implementation usesWeakReference
for stored values in the cache, to support the JVM when it wants to reclaim objects for example during garbage collection. Therefore this implementation does not support all theMap
methods. The following methods is only be be used:- containsKey - To determine if the key is in the cache and refers to a value
- entrySet - To return a set of all the entries (as key/value paris)
- get - To get a value from the cache
- isEmpty - To determine if the cache contains any values
- keySet - To return a set of the current keys which refers to a value
- put - To add a value to the cache
- putAll - To add values to the cache
- remove - To remove a value from the cache by its key
- size - To get the current size
- values - To return a copy of all the value in a list
CaffeineLRUCache.containsValue(Object)
method should not be used as it's not adjusted to check for the existence of a value without catering for the soft references. Notice that if the JVM reclaim memory the content of this cache may be garbage collected, without any eviction notifications. UseLRUCacheFactory
to create a new instance (do not use the constructor).- See Also:
LRUCacheFactory
,CaffeineLRUCache
,CaffeineLRUSoftCache
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.camel.component.caffeine.lrucache.CaffeineLRUCache
evicted, hits, misses
-
-
Constructor Summary
Constructors Constructor Description CaffeineLRUWeakCache(int maximumCacheSize)
Deprecated.CaffeineLRUWeakCache(int initialCapacity, int maximumCacheSize)
Deprecated.CaffeineLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
toString()
Deprecated.-
Methods inherited from class org.apache.camel.component.caffeine.lrucache.CaffeineLRUCache
cleanUp, clear, containsKey, containsValue, entrySet, get, getEvicted, getHits, getMaxCacheSize, getMisses, isEmpty, keySet, onRemoval, put, putAll, remove, resetStatistics, size, values
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
CaffeineLRUWeakCache
public CaffeineLRUWeakCache(int maximumCacheSize)
Deprecated.
-
CaffeineLRUWeakCache
public CaffeineLRUWeakCache(int initialCapacity, int maximumCacheSize)
Deprecated.
-
CaffeineLRUWeakCache
public CaffeineLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Deprecated.
-
-
Method Detail
-
toString
public String toString()
Deprecated.- Overrides:
toString
in classCaffeineLRUCache<K,V>
-
-