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 void
clear()
void
entryWasRemoved(K key, V value)
V
get(Object key)
Set<K>
keys()
V
put(K key, V value)
void
putAll(Map<? extends K,? extends V> map)
V
remove(Object key)
boolean
removeEldestEntry(Map.Entry<K,V> eldest)
void
setSize(int maxMemoryBytes)
String
toString()
-
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:
toString
in classAbstractMap<K,V extends MemoryObject>
-
setSize
public void setSize(int maxMemoryBytes)
-
get
public V get(Object key)
- Specified by:
get
in interfaceMap<K,V extends MemoryObject>
- Overrides:
get
in classLinkedHashMap<K,V extends MemoryObject>
-
put
public V put(K key, V value)
- Specified by:
put
in interfaceMap<K,V extends MemoryObject>
- Overrides:
put
in classHashMap<K,V extends MemoryObject>
-
putAll
public void putAll(Map<? extends K,? extends V> map)
- Specified by:
putAll
in interfaceMap<K,V extends MemoryObject>
- Overrides:
putAll
in classHashMap<K,V extends MemoryObject>
-
remove
public V remove(Object key)
- Specified by:
remove
in interfaceMap<K,V extends MemoryObject>
- Overrides:
remove
in classHashMap<K,V extends MemoryObject>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<K,V extends MemoryObject>
- Overrides:
clear
in classLinkedHashMap<K,V extends MemoryObject>
-
removeEldestEntry
public boolean removeEldestEntry(Map.Entry<K,V> eldest)
- Overrides:
removeEldestEntry
in classLinkedHashMap<K,V extends MemoryObject>
-
-