Class CaffeineLRUCache<K,V>
- java.lang.Object
-
- org.apache.camel.component.caffeine.lrucache.CaffeineLRUCache<K,V>
-
- All Implemented Interfaces:
com.github.benmanes.caffeine.cache.RemovalListener<K,V>
,Serializable
,Map<K,V>
,org.apache.camel.support.LRUCache<K,V>
- Direct Known Subclasses:
CaffeineLRUSoftCache
,CaffeineLRUWeakCache
@Deprecated public class CaffeineLRUCache<K,V> extends Object implements org.apache.camel.support.LRUCache<K,V>, com.github.benmanes.caffeine.cache.RemovalListener<K,V>, Serializable
Deprecated.A cache that uses a near optional LRU Cache. The Cache is implemented by Caffeine which provides an efficient cache. If this cache storesService
then this implementation will on eviction invoke theService.stop()
method, to auto-stop the service. UseLRUCacheFactory
to create a new instance (do not use the constructor).- See Also:
LRUCacheFactory
,CaffeineLRUSoftCache
,CaffeineLRUWeakCache
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CaffeineLRUCache(int maximumCacheSize)
Deprecated.Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.CaffeineLRUCache(int initialCapacity, int maximumCacheSize)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, and will stop on eviction.CaffeineLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.CaffeineLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction, boolean soft, boolean weak, boolean syncListener)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.CaffeineLRUCache(int initialCapacity, int maximumCacheSize, Consumer<V> evict, boolean soft, boolean weak, boolean syncListener)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
cleanUp()
Deprecated.void
clear()
Deprecated.boolean
containsKey(Object o)
Deprecated.boolean
containsValue(Object o)
Deprecated.Set<Map.Entry<K,V>>
entrySet()
Deprecated.V
get(Object o)
Deprecated.long
getEvicted()
Deprecated.Gets the number of evicted entries.long
getHits()
Deprecated.Gets the number of cache hitsint
getMaxCacheSize()
Deprecated.Returns the maxCacheSize.long
getMisses()
Deprecated.Gets the number of cache misses.boolean
isEmpty()
Deprecated.Set<K>
keySet()
Deprecated.void
onRemoval(K key, V value, com.github.benmanes.caffeine.cache.RemovalCause cause)
Deprecated.V
put(K k, V v)
Deprecated.void
putAll(Map<? extends K,? extends V> map)
Deprecated.V
remove(Object o)
Deprecated.void
resetStatistics()
Deprecated.Rest the cache statistics such as hits and misses.int
size()
Deprecated.String
toString()
Deprecated.Collection<V>
values()
Deprecated.-
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
-
CaffeineLRUCache
public CaffeineLRUCache(int maximumCacheSize)
Deprecated.Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.- Parameters:
maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
CaffeineLRUCache
public CaffeineLRUCache(int initialCapacity, int maximumCacheSize)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, and will stop on eviction.- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
CaffeineLRUCache
public CaffeineLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
CaffeineLRUCache
public CaffeineLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction, boolean soft, boolean weak, boolean syncListener)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.soft
- whether to use soft values a soft cache (default is false)weak
- whether to use weak keys/values as a weak cache (default is false)syncListener
- whether to use synchronous call for the eviction listener (default is false)- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
CaffeineLRUCache
public CaffeineLRUCache(int initialCapacity, int maximumCacheSize, Consumer<V> evict, boolean soft, boolean weak, boolean syncListener)
Deprecated.Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode.- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.evict
- callback for evicted elementssoft
- whether to use soft values a soft cache (default is false)weak
- whether to use weak keys/values as a weak cache (default is false)syncListener
- whether to use synchronous call for the eviction listener (default is false)- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
-
Method Detail
-
containsKey
public boolean containsKey(Object o)
Deprecated.- Specified by:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object o)
Deprecated.- Specified by:
containsValue
in interfaceMap<K,V>
-
onRemoval
public void onRemoval(K key, V value, com.github.benmanes.caffeine.cache.RemovalCause cause)
Deprecated.
-
getHits
public long getHits()
Deprecated.Gets the number of cache hits
-
getMisses
public long getMisses()
Deprecated.Gets the number of cache misses.
-
getEvicted
public long getEvicted()
Deprecated.Gets the number of evicted entries.
-
getMaxCacheSize
public int getMaxCacheSize()
Deprecated.Returns the maxCacheSize.
-
resetStatistics
public void resetStatistics()
Deprecated.Rest the cache statistics such as hits and misses.
-
cleanUp
public void cleanUp()
Deprecated.
-
-