Package org.datanucleus.api.jakarta
Class JakartaDataStoreCache
- java.lang.Object
-
- org.datanucleus.api.jakarta.JakartaDataStoreCache
-
- All Implemented Interfaces:
jakarta.persistence.Cache
public class JakartaDataStoreCache extends Object implements jakarta.persistence.Cache
Implementation of the Jakarta Persistence DataStoreCache. Provides a wrapper and hands off calls to the underlying Level2 cache.
-
-
Constructor Summary
Constructors Constructor Description JakartaDataStoreCache(org.datanucleus.PersistenceNucleusContext nucleusCtx)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(Class cls, Object pk)
Accessor for whether the object with specified PK is contained in the cache.void
evict(Class cls)
Evict the parameter instance from the second-level cache.void
evict(Class cls, Object pk)
Evict the parameter instance from the second-level cache.void
evictAll()
Evict all instances from the second-level cache.org.datanucleus.cache.Level2Cache
getLevel2Cache()
Accessor for the underlying Level 2 cache.<T> T
unwrap(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:
contains
in interfacejakarta.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:
evictAll
in interfacejakarta.persistence.Cache
-
evict
public void evict(Class cls)
Evict the parameter instance from the second-level cache.- Specified by:
evict
in interfacejakarta.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:
evict
in interfacejakarta.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:
unwrap
in interfacejakarta.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:
jakarta.persistence.PersistenceException
- if the provider does not support the call.
-
-