Class 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 Detail

      • JPADataStoreCache

        public JPADataStoreCache​(org.datanucleus.PersistenceNucleusContext nucleusCtx)
        Constructor.
        Parameters:
        nucleusCtx - Context
    • 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 interface javax.persistence.Cache
        Parameters:
        cls - The class
        pk - 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 interface javax.persistence.Cache
      • evict

        public void evict​(Class cls)
        Evict the parameter instance from the second-level cache.
        Specified by:
        evict in interface javax.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 interface javax.persistence.Cache
        Parameters:
        cls - Class of which to evict the object
        pk - 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 interface javax.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.