Class StrongRefCache
java.lang.Object
org.datanucleus.cache.StrongRefCache
- All Implemented Interfaces:
Map<Object, DNStateManager>, Level1Cache
Implementation of a Level 1 cache keeping strong references to the objects.
This means that objects are not garbage collected, and have to be removed directly by calls to remove().
This differs from the WeakRefCache/SoftRefCache which do not guarantee to retain objects.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<Object, DNStateManager> private Map<CacheUniqueKey, DNStateManager> static final StringFields 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:
-
cache
-
cacheUnique
-
-
Constructor Details
-
StrongRefCache
public StrongRefCache()
-
-
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
-