Class JavaxCacheLevel2Cache
java.lang.Object
org.datanucleus.cache.AbstractLevel2Cache
org.datanucleus.cache.JavaxCacheLevel2Cache
- All Implemented Interfaces:
Serializable, Level2Cache
Simple implementation of a plugin for use of javax.cache (v0.61+) product with DataNucleus.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javax.cache.CacheCache of CachedPC keyed by "id".private javax.cache.CacheCache of "id" keyed by "uniqueKey".static final Stringprivate static final longFields inherited from class AbstractLevel2Cache
cacheName, clearAtClose, expiryMillis, maxSize, nucleusCtx -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Method to close the cache when no longer needed.booleancontainsOid(Object oid) Accessor for whether the cache contains the specified id.voidEvict the parameter instance from the second-level cache.voidevictAll()Evict the parameter instances from the second-level cache.voidEvict the parameter instances from the second-level cache.voidEvict the parameter instances from the second-level cache.voidevictAll(Collection oids) Evict the parameter instances from the second-level cache.(package private) voidevictAllOfClass(String className) Accessor for an object in the cache.getAll(Collection oids) Accessor for a collection of objects from the cache.getUnique(CacheUniqueKey key) Method to retrieve the id represented by the specified unique key.Method to add an object to the cache under its idvoidMethod to put several objects into the cache.putUnique(CacheUniqueKey key, CachedPC pc) Method to store a persistable object for this unique key.voidputUniqueAll(Map<CacheUniqueKey, CachedPC> objs) Method to put several objects into the cache.voidMethod to remove any object cached against the provided unique key.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Level2Cache
getNumberOfPinnedObjects, getNumberOfUnpinnedObjects, getSize, isEmpty, pin, pinAll, pinAll, pinAll, unpin, unpinAll, unpinAll, unpinAll
-
Field Details
-
NAME
- See Also:
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
cache
private javax.cache.Cache cacheCache of CachedPC keyed by "id". -
cacheUnique
private javax.cache.Cache cacheUniqueCache of "id" keyed by "uniqueKey".
-
-
Constructor Details
-
JavaxCacheLevel2Cache
Constructor.- Parameters:
nucleusCtx- Context
-
-
Method Details
-
close
public void close()Method to close the cache when no longer needed. Provides a hook to release resources etc. -
containsOid
Accessor for whether the cache contains the specified id.- Parameters:
oid- The object id- Returns:
- Whether it is in the cache
- See Also:
-
get
-
getAll
Description copied from interface:Level2CacheAccessor for a collection of objects from the cache.- Parameters:
oids- The Object IDs- Returns:
- Map of the objects, keyed by the oids that are found
-
put
-
putAll
Description copied from interface:Level2CacheMethod to put several objects into the cache.- Parameters:
objs- Map of cacheable object keyed by its oid.
-
evict
Evict the parameter instance from the second-level cache.- Parameters:
oid- the object id of the instance to evict.
-
evictAll
public void evictAll()Evict the parameter instances from the second-level cache. All instances in the PersistenceManager's cache are evicted from the second-level cache. -
evictAll
Evict the parameter instances from the second-level cache.- Parameters:
oids- the object ids of the instance to evict.
-
evictAll
Evict the parameter instances from the second-level cache.- Parameters:
oids- the object ids of the instance to evict.
-
evictAll
Evict the parameter instances from the second-level cache.- Parameters:
pcClass- the class of instances to evictsubclasses- if true, evict instances of subclasses also
-
evictAllOfClass
-
getUnique
Description copied from interface:Level2CacheMethod to retrieve the id represented by the specified unique key.- Parameters:
key- Unique key- Returns:
- The "identity" of the object that this unique key represents
-
putUnique
Description copied from interface:Level2CacheMethod to store a persistable object for this unique key.- Parameters:
key- The unique keypc- The representation of the persistable object to cache- Returns:
- The previous object for this unique key if one was present, otherwise null
-
putUniqueAll
Description copied from interface:Level2CacheMethod to put several objects into the cache.- Parameters:
objs- Map of cacheable object keyed by the unique keys.
-
removeUnique
Description copied from interface:Level2CacheMethod to remove any object cached against the provided unique key.- Parameters:
key- Unique key
-