Package org.datanucleus.cache
Class WeakLevel2Cache
- java.lang.Object
-
- org.datanucleus.cache.AbstractReferencedLevel2Cache
-
- org.datanucleus.cache.WeakLevel2Cache
-
- All Implemented Interfaces:
Serializable
,Level2Cache
public class WeakLevel2Cache extends AbstractReferencedLevel2Cache
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
-
Fields inherited from class org.datanucleus.cache.AbstractReferencedLevel2Cache
apiAdapter, pinnedCache, pinnedClasses, pinnedIds, uniqueKeyCache, unpinnedCache
-
-
Constructor Summary
Constructors Constructor Description WeakLevel2Cache(NucleusContext nucleusCtx)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
initialiseCaches()
-
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 Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WeakLevel2Cache
public WeakLevel2Cache(NucleusContext nucleusCtx)
Constructor.- Parameters:
nucleusCtx
- Context
-
-
Method Detail
-
initialiseCaches
protected void initialiseCaches()
- Specified by:
initialiseCaches
in classAbstractReferencedLevel2Cache
-
-