Package org.datanucleus.api.jpa
Class JPADataStoreCache
- java.lang.Object
-
- org.datanucleus.api.jpa.JPADataStoreCache
-
- All Implemented Interfaces:
javax.persistence.Cache
public class JPADataStoreCache extends Object implements javax.persistence.Cache
Implementation of the JPA DataStoreCache. Provides a wrapper and hands off calls to the underlying Level2 cache.
-
-
Constructor Summary
Constructors Constructor Description JPADataStoreCache(org.datanucleus.PersistenceNucleusContext nucleusCtx)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Class cls, Object pk)Accessor for whether the object with specified PK is contained in the cache.voidevict(Class cls)Evict the parameter instance from the second-level cache.voidevict(Class cls, Object pk)Evict the parameter instance from the second-level cache.voidevictAll()Evict all instances from the second-level cache.org.datanucleus.cache.Level2CachegetLevel2Cache()Accessor for the underlying Level 2 cache.<T> Tunwrap(Class<T> cls)Return an object of the specified type to allow access to the provider-specific API.
-
-
-
Method Detail
-
getLevel2Cache
public org.datanucleus.cache.Level2Cache getLevel2Cache()
Accessor for the underlying Level 2 cache.- Returns:
- Underlying L2 cache.
-
contains
public boolean contains(Class cls, Object pk)
Accessor for whether the object with specified PK is contained in the cache.- Specified by:
containsin interfacejavax.persistence.Cache- Parameters:
cls- The classpk- PK of the instance to evict.- Returns:
- whether it is contained
-
evictAll
public void evictAll()
Evict all instances from the second-level cache.- Specified by:
evictAllin interfacejavax.persistence.Cache
-
evict
public void evict(Class cls)
Evict the parameter instance from the second-level cache.- Specified by:
evictin interfacejavax.persistence.Cache- Parameters:
cls- Class of which to evict all objects
-
evict
public void evict(Class cls, Object pk)
Evict the parameter instance from the second-level cache.- Specified by:
evictin interfacejavax.persistence.Cache- Parameters:
cls- Class of which to evict the objectpk- PK of the instance to evict.
-
unwrap
public <T> T unwrap(Class<T> cls)
Return an object of the specified type to allow access to the provider-specific API. If the provider's Cache implementation does not support the specified class, the PersistenceException is thrown.- Specified by:
unwrapin interfacejavax.persistence.Cache- Parameters:
cls- the class of the object to be returned. This is normally either the underlying Cache implementation class or an interface that it implements.- Returns:
- an instance of the specified class
- Throws:
javax.persistence.PersistenceException- if the provider does not support the call.
-
-