- java.lang.Object
-
- org.datanucleus.cache.StrongRefCache
-
- All Implemented Interfaces:
Map<Object,DNStateManager>
,Level1Cache
public class StrongRefCache extends Object implements 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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
-
Fields inherited from interface org.datanucleus.cache.Level1Cache
NONE_NAME
-
-
Constructor Summary
Constructors Constructor Description StrongRefCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object id)
boolean
containsValue(Object value)
Set
entrySet()
DNStateManager
get(Object id)
DNStateManager
getUnique(CacheUniqueKey key)
Method to retrieve StateManager for the specified unique key.boolean
isEmpty()
Set
keySet()
DNStateManager
put(Object id, DNStateManager sm)
void
putAll(Map t)
Object
putUnique(CacheUniqueKey key, DNStateManager sm)
Method to store a StateManager for this unique key.DNStateManager
remove(Object id)
int
size()
Collection
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 Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
put
public DNStateManager put(Object id, DNStateManager sm)
- Specified by:
put
in interfaceMap<Object,DNStateManager>
-
get
public DNStateManager get(Object id)
- Specified by:
get
in interfaceMap<Object,DNStateManager>
-
containsKey
public boolean containsKey(Object id)
- Specified by:
containsKey
in interfaceMap<Object,DNStateManager>
-
remove
public DNStateManager remove(Object id)
- Specified by:
remove
in interfaceMap<Object,DNStateManager>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<Object,DNStateManager>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<Object,DNStateManager>
-
entrySet
public Set entrySet()
- Specified by:
entrySet
in interfaceMap<Object,DNStateManager>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<Object,DNStateManager>
-
keySet
public Set keySet()
- Specified by:
keySet
in interfaceMap<Object,DNStateManager>
-
putAll
public void putAll(Map t)
- Specified by:
putAll
in interfaceMap<Object,DNStateManager>
-
size
public int size()
- Specified by:
size
in interfaceMap<Object,DNStateManager>
-
values
public Collection values()
- Specified by:
values
in interfaceMap<Object,DNStateManager>
-
getUnique
public DNStateManager getUnique(CacheUniqueKey key)
Description copied from interface:Level1Cache
Method to retrieve StateManager for the specified unique key.- Specified by:
getUnique
in interfaceLevel1Cache
- Parameters:
key
- Unique key- Returns:
- StateManager if one is cached for this unique key
-
putUnique
public Object putUnique(CacheUniqueKey key, DNStateManager sm)
Description copied from interface:Level1Cache
Method to store a StateManager for this unique key.- Specified by:
putUnique
in interfaceLevel1Cache
- Parameters:
key
- The unique keysm
- StateManager- Returns:
- The previous StateManager for this unique key if one was present, otherwise null
-
-