public abstract class LRUCacheFactory extends Object
LRUCache
instances.Constructor and Description |
---|
LRUCacheFactory() |
Modifier and Type | Method and Description |
---|---|
abstract <K,V> Map<K,V> |
createLRUCache(int maximumCacheSize)
Constructs an empty LRUCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
abstract <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.
|
abstract <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.
|
abstract <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.
|
abstract <K,V> Map<K,V> |
createLRUSoftCache(int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
abstract <K,V> Map<K,V> |
createLRUSoftCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
abstract <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.
|
abstract <K,V> Map<K,V> |
createLRUWeakCache(int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
abstract <K,V> Map<K,V> |
createLRUWeakCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
abstract <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.
|
static LRUCacheFactory |
getInstance()
Gets (and creates if needed) the LRUCacheFactory to use.
|
static void |
init()
Initializes and creates the cache factory if not explicit set.
|
static <K,V> Map<K,V> |
newLRUCache(int maximumCacheSize)
Constructs an empty LRUCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUCache(int maximumCacheSize,
Consumer<V> onEvict)
Constructs an empty LRUCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUCache instance with the
specified initial capacity, maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUCache instance with the
specified initial capacity, maximumCacheSize,load factor and ordering mode.
|
static <K,V> Map<K,V> |
newLRUSoftCache(int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUSoftCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUSoftCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUSoftCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUSoftCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUWeakCache(int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUWeakCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUWeakCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static <K,V> Map<K,V> |
newLRUWeakCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUWeakCache instance with the
specified maximumCacheSize, and will stop on eviction.
|
static void |
setLRUCacheFactory(LRUCacheFactory cacheFactory)
Use this to set a specific LRUCacheFactory instance, such as before starting Camel, that
then avoids doing auto discovery of the cache factory via classpath.
|
public static final String FACTORY
public static void init()
public static void setLRUCacheFactory(LRUCacheFactory cacheFactory)
public static LRUCacheFactory getInstance()
public static <K,V> Map<K,V> newLRUCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUCache(int maximumCacheSize, Consumer<V> onEvict)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUSoftCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUSoftCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUWeakCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUWeakCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic static <K,V> Map<K,V> newLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUCache(int maximumCacheSize, Consumer<V> onEvict)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUSoftCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUSoftCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUWeakCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.IllegalArgumentException
- if the initial capacity is negativepublic abstract <K,V> Map<K,V> createLRUWeakCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.IllegalArgumentException
- if the initial capacity is negativeApache Camel