Package org.hibernate.cache.spi.support
Class AbstractCachedDomainDataAccess
java.lang.Object
org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
- All Implemented Interfaces:
CachedDomainDataAccess,AbstractDomainDataRegion.Destructible
- Direct Known Subclasses:
AbstractCollectionDataAccess,AbstractEntityDataAccess,AbstractNaturalIdDataAccess,AbstractReadWriteAccess
public abstract class AbstractCachedDomainDataAccess
extends Object
implements CachedDomainDataAccess, AbstractDomainDataRegion.Destructible
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCachedDomainDataAccess(DomainDataRegion region, DomainDataStorageAccess storageAccess) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbooleanDetermine whether this region contains data for the given key.voiddestroy()voidForcibly evict an item from the cache immediately without regard for transaction isolation and/or locking.voidevictAll()Forcibly evict all items from the cache immediately without regard for transaction isolation.get(SharedSessionContractImplementor session, Object key) Attempt to retrieve an object from the cache.The region containing the data being accessedLock the entire regionbooleanputFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version) Attempt to cache an object, after loading it from the database.booleanputFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride) Attempt to cache an object, after loading from the database, explicitly specifying theminimalPutbehavior.voidremove(SharedSessionContractImplementor session, Object key) Notify that an item has become stale, before completion of the transaction.voidRemove all data for this accessed type.voidunlockRegion(SoftLock lock) Called after we have finished the attempted invalidation of the entire regionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.cache.spi.access.CachedDomainDataAccess
getAccessType, lockItem, unlockItem
-
Constructor Details
-
AbstractCachedDomainDataAccess
protected AbstractCachedDomainDataAccess(DomainDataRegion region, DomainDataStorageAccess storageAccess)
-
-
Method Details
-
getRegion
Description copied from interface:CachedDomainDataAccessThe region containing the data being accessed- Specified by:
getRegionin interfaceCachedDomainDataAccess
-
getStorageAccess
-
clearCache
protected void clearCache() -
contains
Description copied from interface:CachedDomainDataAccessDetermine 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.
- Specified by:
containsin interfaceCachedDomainDataAccess- Parameters:
key- The cache key- Returns:
- True if the underlying cache contains corresponding data; false otherwise.
-
lockRegion
Description copied from interface:CachedDomainDataAccessLock the entire region- Specified by:
lockRegionin interfaceCachedDomainDataAccess- Returns:
- A representation of our lock on the item; or
null.
-
unlockRegion
Description copied from interface:CachedDomainDataAccessCalled after we have finished the attempted invalidation of the entire region- Specified by:
unlockRegionin interfaceCachedDomainDataAccess- Parameters:
lock- The lock previously obtained fromCachedDomainDataAccess.lockRegion()
-
evict
Description copied from interface:CachedDomainDataAccessForcibly 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 extensionCache.evictEntityData(Class, Object)andCache.evictEntityData(String, Object)- Specified by:
evictin interfaceCachedDomainDataAccess- Parameters:
key- The key of the item to remove
-
evictAll
public void evictAll()Description copied from interface:CachedDomainDataAccessForcibly evict all items from the cache immediately without regard for transaction isolation. This behavior is exactly Hibernate legacy behavior, but it is also required by JPA - so we cannot remove it.Used from our JPA impl of
Cache.evictAll()as well as the Hibernate extensionsCache.evictEntityData(Class),Cache.evictEntityData(String)andCache.evictEntityData()- Specified by:
evictAllin interfaceCachedDomainDataAccess
-
destroy
public void destroy()- Specified by:
destroyin interfaceAbstractDomainDataRegion.Destructible
-