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 Least Recently Used cache. 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 TypeMethodDescriptionvoidclear()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()keySet()voidputIfAbsent(K key, V value) booleanbooleanvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) intsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
remove
-
put
-
remove
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceMap<K,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceMap<K,V>
-
compute
-
merge
-
replace
-
replace
-
putAll
-
clear
public void clear() -
keySet
-
values
-
replaceAll
- Specified by:
replaceAllin interfaceMap<K,V>
-
entrySet
-