public class WeakLevel2Cache extends AbstractReferencedLevel2Cache
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.
Modifier and Type | Field and Description |
---|---|
static String |
NAME |
apiAdapter, pinnedCache, pinnedClasses, pinnedIds, uniqueKeyCache, unpinnedCache
Constructor and Description |
---|
WeakLevel2Cache(NucleusContext nucleusCtx)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
initialiseCaches() |
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
public static final String NAME
public WeakLevel2Cache(NucleusContext nucleusCtx)
nucleusCtx
- Contextprotected void initialiseCaches()
initialiseCaches
in class AbstractReferencedLevel2Cache
Copyright © 2020. All rights reserved.