public class SoftCache<K,V> extends AbstractMap<K,V>
SoftReference objects.
This is therefore supposed to act like a memory-limited LRU cache.
However, it's at the mercy of the JVM SoftReference implementation,
so it's not guaranteed that it's going to do a good job of it.
Note: I read a comment somewhere that the Sun/Oracle JVM will
drop these cache entries less aggressively if it's running in
-server rather than -client mode.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
SoftCache()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(Object key) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
void |
purge()
Deletes any entries that have been garbage collected.
|
V |
put(K key,
V value) |
V |
remove(Object key) |
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic void purge()
public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.