Class ConcurrentLRUCache<K,V extends MemoryObject>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.apache.jackrabbit.oak.index.indexer.document.tree.store.utils.ConcurrentLRUCache<K,V>
-
- Type Parameters:
K- the key typeV- the value type
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
public class ConcurrentLRUCache<K,V extends MemoryObject> extends LinkedHashMap<K,V>
A synchronized LRU cache. The cache size is limited by the amount of memory (and not number of entries).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description ConcurrentLRUCache(long maxMemoryBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()voidentryWasRemoved(K key, V value)Vget(Object key)Set<K>keys()Vput(K key, V value)voidputAll(Map<? extends K,? extends V> map)Vremove(Object key)booleanremoveEldestEntry(Map.Entry<K,V> eldest)voidsetSize(int maxMemoryBytes)StringtoString()-
Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, size
-
-
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classAbstractMap<K,V extends MemoryObject>
-
setSize
public void setSize(int maxMemoryBytes)
-
get
public V get(Object key)
- Specified by:
getin interfaceMap<K,V extends MemoryObject>- Overrides:
getin classLinkedHashMap<K,V extends MemoryObject>
-
put
public V put(K key, V value)
- Specified by:
putin interfaceMap<K,V extends MemoryObject>- Overrides:
putin classHashMap<K,V extends MemoryObject>
-
putAll
public void putAll(Map<? extends K,? extends V> map)
- Specified by:
putAllin interfaceMap<K,V extends MemoryObject>- Overrides:
putAllin classHashMap<K,V extends MemoryObject>
-
remove
public V remove(Object key)
- Specified by:
removein interfaceMap<K,V extends MemoryObject>- Overrides:
removein classHashMap<K,V extends MemoryObject>
-
clear
public void clear()
- Specified by:
clearin interfaceMap<K,V extends MemoryObject>- Overrides:
clearin classLinkedHashMap<K,V extends MemoryObject>
-
removeEldestEntry
public boolean removeEldestEntry(Map.Entry<K,V> eldest)
- Overrides:
removeEldestEntryin classLinkedHashMap<K,V extends MemoryObject>
-
-