Package org.apache.camel.support
Class DefaultLRUCacheFactory
- java.lang.Object
-
- org.apache.camel.support.LRUCacheFactory
-
- org.apache.camel.support.DefaultLRUCacheFactory
-
public class DefaultLRUCacheFactory extends LRUCacheFactory
DefaultLRUCacheFactory
which uses aLinkedHashMap
based implementation.
-
-
Field Summary
-
Fields inherited from class org.apache.camel.support.LRUCacheFactory
FACTORY
-
-
Constructor Summary
Constructors Constructor Description DefaultLRUCacheFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 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>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>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.-
Methods inherited from class org.apache.camel.support.LRUCacheFactory
getInstance, init, newLRUCache, newLRUCache, newLRUCache, newLRUCache, newLRUSoftCache, newLRUSoftCache, newLRUSoftCache, newLRUWeakCache, newLRUWeakCache, newLRUWeakCache, setLRUCacheFactory
-
-
-
-
Method Detail
-
createLRUCache
public <K,V> Map<K,V> createLRUCache(int maximumCacheSize)
Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUCache
in classLRUCacheFactory
- Parameters:
maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUCache
public <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.- Specified by:
createLRUCache
in classLRUCacheFactory
- Parameters:
maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUCache
public <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.- Specified by:
createLRUCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUCache
public <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.- Specified by:
createLRUCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUSoftCache
public <K,V> Map<K,V> createLRUSoftCache(int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUSoftCache
in classLRUCacheFactory
- Parameters:
maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUSoftCache
public <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize)
Description copied from class:LRUCacheFactory
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUSoftCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.
-
createLRUSoftCache
public <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Description copied from class:LRUCacheFactory
Constructs an empty LRUSoftCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUSoftCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.
-
createLRUWeakCache
public <K,V> Map<K,V> createLRUWeakCache(int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUWeakCache
in classLRUCacheFactory
- Parameters:
maximumCacheSize
- the max capacity.- Throws:
IllegalArgumentException
- if the initial capacity is negative
-
createLRUWeakCache
public <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize)
Description copied from class:LRUCacheFactory
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUWeakCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.
-
createLRUWeakCache
public <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
Description copied from class:LRUCacheFactory
Constructs an empty LRUWeakCache instance with the specified maximumCacheSize, and will stop on eviction.- Specified by:
createLRUWeakCache
in classLRUCacheFactory
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.
-
-