Package org.datanucleus.cache
Class WeakLevel2Cache
java.lang.Object
org.datanucleus.cache.AbstractReferencedLevel2Cache
org.datanucleus.cache.WeakLevel2Cache
- All Implemented Interfaces:
Serializable
,Level2Cache
Weak referenced implementation of a Level 2 cache.
Operates with 3 maps internally. One stores all pinned objects that have been selected to be retained by user's application. The second stores all other objects, and is the default location where objects are placed when being added here, using weak references meaning that they can get garbage collected as necessary by the JVM. The third stores objects keyed by the unique key that they relate to.
Maintains collections of the classes and the identities that are to be pinned if they ever are put into the cache. These are defined by the pinAll(), pin() methods.
All mutating methods, and the get method have been synchronized to prevent conflicts.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.datanucleus.cache.AbstractReferencedLevel2Cache
AbstractReferencedLevel2Cache.PinnedClass
-
Field Summary
FieldsFields inherited from class org.datanucleus.cache.AbstractReferencedLevel2Cache
apiAdapter, pinnedCache, pinnedClasses, pinnedIds, uniqueKeyCache, unpinnedCache
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.datanucleus.cache.AbstractReferencedLevel2Cache
close, containsOid, evict, evictAll, evictAll, evictAll, evictAll, get, getAll, getNumberOfPinnedObjects, getNumberOfUnpinnedObjects, getSize, getUnique, isEmpty, pin, pinAll, pinAll, pinAll, put, putAll, putUnique, putUniqueAll, removeUnique, unpin, unpinAll, unpinAll, unpinAll
-
Field Details
-
NAME
- See Also:
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
WeakLevel2Cache
Constructor.- Parameters:
nucleusCtx
- Context
-
-
Method Details
-
initialiseCaches
protected void initialiseCaches()- Specified by:
initialiseCaches
in classAbstractReferencedLevel2Cache
-