public class SoftRefCache extends Object implements Level1Cache
If map entry value object is not actively being used, i.e. no other object has a strong reference to it,
it may become garbage collected at the discretion of the garbage collector (typically if the VM is low on memory).
If this happens, the entry in the SoftValueMap
corresponding to the value object will also be removed.
SoftReference
Constructor and Description |
---|
SoftRefCache() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object id) |
boolean |
containsValue(Object value) |
Set |
entrySet() |
ObjectProvider |
get(Object id) |
ObjectProvider |
getUnique(CacheUniqueKey key)
Method to retrieve the ObjectProvider for the specified unique key.
|
boolean |
isEmpty() |
Set |
keySet() |
ObjectProvider |
put(Object id,
ObjectProvider op) |
void |
putAll(Map t) |
Object |
putUnique(CacheUniqueKey key,
ObjectProvider op)
Method to store an ObjectProvider for this unique key.
|
ObjectProvider |
remove(Object id) |
int |
size() |
Collection |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public ObjectProvider put(Object id, ObjectProvider op)
put
in interface Map<Object,ObjectProvider>
public ObjectProvider get(Object id)
get
in interface Map<Object,ObjectProvider>
public boolean containsKey(Object id)
containsKey
in interface Map<Object,ObjectProvider>
public ObjectProvider remove(Object id)
remove
in interface Map<Object,ObjectProvider>
public void clear()
clear
in interface Map<Object,ObjectProvider>
public boolean containsValue(Object value)
containsValue
in interface Map<Object,ObjectProvider>
public Set entrySet()
entrySet
in interface Map<Object,ObjectProvider>
public boolean isEmpty()
isEmpty
in interface Map<Object,ObjectProvider>
public Set keySet()
keySet
in interface Map<Object,ObjectProvider>
public void putAll(Map t)
putAll
in interface Map<Object,ObjectProvider>
public int size()
size
in interface Map<Object,ObjectProvider>
public Collection values()
values
in interface Map<Object,ObjectProvider>
public ObjectProvider getUnique(CacheUniqueKey key)
Level1Cache
getUnique
in interface Level1Cache
key
- Unique keypublic Object putUnique(CacheUniqueKey key, ObjectProvider op)
Level1Cache
putUnique
in interface Level1Cache
key
- The unique keyop
- The ObjectProviderCopyright © 2019. All rights reserved.