Interface CachedDomainDataAccess

    • Method Detail

      • getRegion

        DomainDataRegion getRegion()
        The region containing the data being accessed
      • getAccessType

        AccessType getAccessType()
        The type of access implemented
      • get

        Object get​(SharedSessionContractImplementor session,
                   Object key)
        Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
        Parameters:
        session - Current session.
        key - The key of the item to be retrieved.
        Returns:
        the cached data or null
        Throws:
        CacheException - Propagated from underlying cache provider
      • putFromLoad

        boolean putFromLoad​(SharedSessionContractImplementor session,
                            Object key,
                            Object value,
                            Object version)
        Attempt to cache an object, afterQuery loading from the database.
        Parameters:
        session - Current session.
        key - The item key
        value - The item
        version - the item version number
        Returns:
        true if the object was successfully cached
        Throws:
        CacheException - Propagated from underlying cache provider
      • putFromLoad

        boolean putFromLoad​(SharedSessionContractImplementor session,
                            Object key,
                            Object value,
                            Object version,
                            boolean minimalPutOverride)
        Attempt to cache an object, afterQuery loading from the database, explicitly specifying the minimalPut behavior.
        Parameters:
        session - Current session.
        key - The item key
        value - The item
        version - the item version number
        minimalPutOverride - Explicit minimalPut flag
        Returns:
        true if the object was successfully cached
        Throws:
        CacheException - Propagated from underlying cache provider
      • remove

        void remove​(SharedSessionContractImplementor session,
                    Object key)
        Called afterQuery an item has become stale (beforeQuery the transaction completes). This method is used by "synchronous" concurrency strategies.
        Parameters:
        session - Current session.
        key - The key of the item to remove
        Throws:
        CacheException - Propagated from underlying cache provider
      • contains

        boolean contains​(Object key)
        Determine whether this region contains data for the given key.

        The semantic here is whether the cache contains data visible for the current call context. This should be viewed as a "best effort", meaning blocking should be avoided if possible.

        Parameters:
        key - The cache key
        Returns:
        True if the underlying cache contains corresponding data; false otherwise.
      • lockRegion

        SoftLock lockRegion()
        Lock the entire region
        Returns:
        A representation of our lock on the item; or null.
        Throws:
        CacheException - Propagated from underlying cache provider
      • unlockRegion

        void unlockRegion​(SoftLock lock)
        Called after we have finished the attempted invalidation of the entire region
        Parameters:
        lock - The lock previously obtained from lockRegion()
        Throws:
        CacheException - Propagated from underlying cache provider
      • evict

        void evict​(Object key)
        Forcibly evict an item from the cache immediately without regard for transaction isolation and/or locking. This behavior is exactly Hibernate legacy behavior, but it is also required by JPA - so we cannot remove it.

        Used from JPA's Cache.evict(Class, Object), as well as the Hibernate extension org.hibernate.Cache#evictEntityData(Class, Serializable) and org.hibernate.Cache#evictEntityData(String, Serializable)

        Parameters:
        key - The key of the item to remove
        Throws:
        CacheException - Propagated from underlying cache provider