- java.lang.Object
-
- org.datanucleus.cache.WeakRefCache
-
- All Implemented Interfaces:
Map<Object,DNStateManager>,Level1Cache
public class WeakRefCache extends Object implements Level1Cache
Level 1 Cache using Weak referenced objects in a Map. If the garbage collector clears the reference, the corresponding key is automatically removed from the map.- See Also:
WeakReference
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAME-
Fields inherited from interface org.datanucleus.cache.Level1Cache
NONE_NAME
-
-
Constructor Summary
Constructors Constructor Description WeakRefCache()Default constructor (required)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object id)booleancontainsValue(Object value)SetentrySet()DNStateManagerget(Object id)DNStateManagergetUnique(CacheUniqueKey key)Method to retrieve StateManager for the specified unique key.booleanisEmpty()SetkeySet()DNStateManagerput(Object id, DNStateManager sm)voidputAll(Map t)ObjectputUnique(CacheUniqueKey key, DNStateManager sm)Method to store a StateManager for this unique key.DNStateManagerremove(Object id)intsize()Collectionvalues()-
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:
putin interfaceMap<Object,DNStateManager>
-
get
public DNStateManager get(Object id)
- Specified by:
getin interfaceMap<Object,DNStateManager>
-
containsKey
public boolean containsKey(Object id)
- Specified by:
containsKeyin interfaceMap<Object,DNStateManager>
-
remove
public DNStateManager remove(Object id)
- Specified by:
removein interfaceMap<Object,DNStateManager>
-
clear
public void clear()
- Specified by:
clearin interfaceMap<Object,DNStateManager>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<Object,DNStateManager>
-
entrySet
public Set entrySet()
- Specified by:
entrySetin interfaceMap<Object,DNStateManager>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceMap<Object,DNStateManager>
-
keySet
public Set keySet()
- Specified by:
keySetin interfaceMap<Object,DNStateManager>
-
putAll
public void putAll(Map t)
- Specified by:
putAllin interfaceMap<Object,DNStateManager>
-
size
public int size()
- Specified by:
sizein interfaceMap<Object,DNStateManager>
-
values
public Collection values()
- Specified by:
valuesin interfaceMap<Object,DNStateManager>
-
getUnique
public DNStateManager getUnique(CacheUniqueKey key)
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
public Object putUnique(CacheUniqueKey key, DNStateManager sm)
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
-
-