public class DefaultLRUCacheFactory extends LRUCacheFactory
LRUCacheFactory
which uses a LinkedHashMap
. You can use camel-caffeine-lrucache instead which
has a better LRUCache implementation.FACTORY
Constructor and Description |
---|
DefaultLRUCacheFactory() |
Modifier and Type | Method and Description |
---|---|
<K,V> Map<K,V> |
createLRUCache(int maximumCacheSize)
Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.
|
<K,V> Map<K,V> |
createLRUCache(int maximumCacheSize,
Consumer<V> onEvict)
Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.
|
<K,V> Map<K,V> |
createLRUCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, and will
stop on eviction.
|
<K,V> Map<K,V> |
createLRUCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor
and ordering mode.
|
<K,V> Map<K,V> |
createLRUSoftCache(int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
<K,V> Map<K,V> |
createLRUSoftCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
<K,V> Map<K,V> |
createLRUSoftCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
<K,V> Map<K,V> |
createLRUWeakCache(int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
<K,V> Map<K,V> |
createLRUWeakCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
<K,V> Map<K,V> |
createLRUWeakCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on
eviction.
|
getInstance, init, newLRUCache, newLRUCache, newLRUCache, newLRUCache, newLRUSoftCache, newLRUSoftCache, newLRUSoftCache, newLRUWeakCache, newLRUWeakCache, newLRUWeakCache, setLRUCacheFactory
public <K,V> Map<K,V> createLRUCache(int maximumCacheSize)
createLRUCache
in class LRUCacheFactory
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUCache(int maximumCacheSize, Consumer<V> onEvict)
createLRUCache
in class LRUCacheFactory
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize)
createLRUCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
createLRUCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUSoftCache(int maximumCacheSize)
createLRUSoftCache
in class LRUCacheFactory
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize)
LRUCacheFactory
createLRUSoftCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.public <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
LRUCacheFactory
createLRUSoftCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.public <K,V> Map<K,V> createLRUWeakCache(int maximumCacheSize)
createLRUWeakCache
in class LRUCacheFactory
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize)
LRUCacheFactory
createLRUWeakCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.public <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
LRUCacheFactory
createLRUWeakCache
in class LRUCacheFactory
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.Apache Camel