Package org.apache.camel.support.cache
Class SimpleLRUCache<K,V>
java.lang.Object
org.apache.camel.support.cache.SimpleLRUCache<K,V>
- Type Parameters:
K
- type of the keyV
- type of the value
- All Implemented Interfaces:
Map<K,
V>
SimpleLRUCache
is a simple implementation of a cache of type Least Recently Used . The implementation doesn't
accept null values. Generally speaking, the parameters of all the public methods must have a value otherwise a
NullPointerException
is thrown.-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleLRUCache
(int initialCapacity, int maximumCacheSize, Consumer<V> evicted) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
isEmpty()
keySet()
void
putIfAbsent
(K key, V value) boolean
boolean
void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) int
size()
values()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
equals, forEach, getOrDefault, hashCode
-
Constructor Details
-
SimpleLRUCache
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
-
remove
-
put
-
remove
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
computeIfAbsent
- Specified by:
computeIfAbsent
in interfaceMap<K,
V>
-
computeIfPresent
- Specified by:
computeIfPresent
in interfaceMap<K,
V>
-
compute
-
merge
-
replace
-
replace
-
putAll
-
clear
public void clear() -
keySet
-
values
-
replaceAll
- Specified by:
replaceAll
in interfaceMap<K,
V>
-
entrySet
-