Class SoftRefMap<K,V>
java.lang.Object
com.inductiveautomation.ignition.common.util.SoftRefMap<K,V>
- All Implemented Interfaces:
Map<K,
V>
A very simple cache map implementation using soft references around the keys. This class is very much NOT
thread-safe, so if there is any multi- threaded use, you must wrap in Collections.synchronizedMap(). Also,
containsValue(), entrySet(), and values() are not supported. This class also doesn't prune the keys for cleared
references aggressivly - you can prune them yourself by calling pruneClearedReferences()
XXX Colby says: just happened upon this... might be worth looking into replacing this class with the Google Collections MapMaker, which supports soft keys, concurrency, auto pruning, and a value generation function.
XXX Colby says: just happened upon this... might be worth looking into replacing this class with the Google Collections MapMaker, which supports soft keys, concurrency, auto pruning, and a value generation function.
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
isEmpty()
keySet()
void
void
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
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
map
-
-
Constructor Details
-
SoftRefMap
public SoftRefMap()
-
-
Method Details
-
clear
public void clear() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
entrySet
-
values
-
pruneClearedReferences
public void pruneClearedReferences() -
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size()
-