Class CachingMap<T>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,SoftReference<T>>
-
- org.apache.sling.scripting.core.impl.helper.CachingMap<T>
-
- Type Parameters:
T
- the type to whichSoftReference
s will be kept
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,SoftReference<T>>
public class CachingMap<T> extends LinkedHashMap<String,SoftReference<T>>
The
CachingMap
class offers an implementation of aLinkedHashMap
that can be used for caches. The maps' values areSoftReference
s, such that garbage collection can be performed on the cache, if needed.Read / write operations are NOT synchronised.
- 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 CachingMap(int capacity)
Creates a caching map with a maximum capacity equal to thecapacity
parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
removeEldestEntry(Map.Entry<String,SoftReference<T>> eldest)
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
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, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
removeEldestEntry
protected boolean removeEldestEntry(Map.Entry<String,SoftReference<T>> eldest)
- Overrides:
removeEldestEntry
in classLinkedHashMap<String,SoftReference<T>>
-
-