Class SoftRefCache
java.lang.Object
org.datanucleus.cache.SoftRefCache
- All Implemented Interfaces:
Map<Object, DNStateManager>, Level1Cache
Level 1 Cache using Soft referenced objects in a Map.
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.
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate Map<Object, DNStateManager> private Map<CacheUniqueKey, DNStateManager> Fields inherited from interface Level1Cache
NONE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object id) booleancontainsValue(Object value) entrySet()getUnique(CacheUniqueKey key) Method to retrieve StateManager for the specified unique key.booleanisEmpty()keySet()put(Object id, DNStateManager sm) voidputUnique(CacheUniqueKey key, DNStateManager sm) Method to store a StateManager for this unique key.intsize()values()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
NAME
- See Also:
-
softCache
-
softCacheUnique
-
-
Constructor Details
-
SoftRefCache
public SoftRefCache()
-
-
Method Details
-
put
- Specified by:
putin interfaceMap<Object, DNStateManager>
-
get
- Specified by:
getin interfaceMap<Object, DNStateManager>
-
containsKey
- Specified by:
containsKeyin interfaceMap<Object, DNStateManager>
-
remove
- Specified by:
removein interfaceMap<Object, DNStateManager>
-
clear
public void clear()- Specified by:
clearin interfaceMap<Object, DNStateManager>
-
containsValue
- Specified by:
containsValuein interfaceMap<Object, DNStateManager>
-
entrySet
- Specified by:
entrySetin interfaceMap<Object, DNStateManager>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap<Object, DNStateManager>
-
keySet
- Specified by:
keySetin interfaceMap<Object, DNStateManager>
-
putAll
- Specified by:
putAllin interfaceMap<Object, DNStateManager>
-
size
public int size()- Specified by:
sizein interfaceMap<Object, DNStateManager>
-
values
- Specified by:
valuesin interfaceMap<Object, DNStateManager>
-
getUnique
Description copied from interface:Level1CacheMethod to retrieve StateManager for the specified unique key.- Specified by:
getUniquein interfaceLevel1Cache- Parameters:
key- Unique key- Returns:
- StateManager if one is cached for this unique key
-
putUnique
Description copied from interface:Level1CacheMethod to store a StateManager for this unique key.- Specified by:
putUniquein interfaceLevel1Cache- Parameters:
key- The unique keysm- StateManager- Returns:
- The previous StateManager for this unique key if one was present, otherwise null
-