public abstract class AbstractCachedDomainDataAccess extends Object implements CachedDomainDataAccess, AbstractDomainDataRegion.Destructible
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCachedDomainDataAccess(DomainDataRegion region,
DomainDataStorageAccess storageAccess) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearCache() |
boolean |
contains(Object key)
Determine whether this region contains data for the given key.
|
void |
destroy() |
void |
evict(Object key)
Forcibly evict an item from the cache immediately without regard for transaction
isolation and/or locking.
|
void |
evictAll()
Forcibly evict all items from the cache immediately without regard for transaction
isolation.
|
Object |
get(SharedSessionContractImplementor session,
Object key)
Attempt to retrieve an object from the cache.
|
DomainDataRegion |
getRegion()
The region containing the data being accessed
|
protected DomainDataStorageAccess |
getStorageAccess() |
SoftLock |
lockRegion()
Lock the entire region
|
boolean |
putFromLoad(SharedSessionContractImplementor session,
Object key,
Object value,
Object version)
Attempt to cache an object, afterQuery loading from the database.
|
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.
|
void |
remove(SharedSessionContractImplementor session,
Object key)
Called afterQuery an item has become stale (beforeQuery the transaction completes).
|
void |
removeAll(SharedSessionContractImplementor session)
Remove all data for this accessed type
|
void |
unlockRegion(SoftLock lock)
Called after we have finished the attempted invalidation of the entire
region
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAccessType, lockItem, unlockItemprotected AbstractCachedDomainDataAccess(DomainDataRegion region, DomainDataStorageAccess storageAccess)
public DomainDataRegion getRegion()
CachedDomainDataAccessThe region containing the data being accessed
getRegion in interface CachedDomainDataAccessprotected DomainDataStorageAccess getStorageAccess()
protected void clearCache()
public boolean contains(Object key)
CachedDomainDataAccessDetermine whether this region contains data for the given key. <p/> 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 avoid if possible.
contains in interface CachedDomainDataAccesskey - The cache keypublic Object get(SharedSessionContractImplementor session, Object key)
CachedDomainDataAccessAttempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
get in interface CachedDomainDataAccesssession - Current session.key - The key of the item to be retrieved.nullpublic boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version)
CachedDomainDataAccessAttempt to cache an object, afterQuery loading from the database.
putFromLoad in interface CachedDomainDataAccesssession - Current session.key - The item keyvalue - The itemversion - the item version numbertrue if the object was successfully cachedpublic boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride)
CachedDomainDataAccessAttempt to cache an object, afterQuery loading from the database, explicitly specifying the minimalPut behavior.
putFromLoad in interface CachedDomainDataAccesssession - Current session.key - The item keyvalue - The itemversion - the item version numberminimalPutOverride - Explicit minimalPut flagtrue if the object was successfully cachedpublic SoftLock lockRegion()
CachedDomainDataAccessLock the entire region
lockRegion in interface CachedDomainDataAccessnull.public void unlockRegion(SoftLock lock)
CachedDomainDataAccessCalled after we have finished the attempted invalidation of the entire region
unlockRegion in interface CachedDomainDataAccesslock - The lock previously obtained from CachedDomainDataAccess.lockRegion()public void remove(SharedSessionContractImplementor session, Object key)
CachedDomainDataAccessCalled afterQuery an item has become stale (beforeQuery the transaction completes). This method is used by "synchronous" concurrency strategies.
remove in interface CachedDomainDataAccesssession - Current session.key - The key of the item to removepublic void removeAll(SharedSessionContractImplementor session)
CachedDomainDataAccessRemove all data for this accessed type
removeAll in interface CachedDomainDataAccesspublic void evict(Object key)
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.
<p/>
Used from JPA’s Cache.evict(Class, Object), as well as the
Hibernate extension Cache.evictEntityData(Class, Serializable)
and Cache.evictEntityData(String, Serializable)
evict in interface CachedDomainDataAccesskey - The key of the item to removepublic void evictAll()
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.
<p/>
Used from our JPA impl of Cache.evictAll() as well as the Hibernate
extensions Cache.evictEntityData(Class),
Cache.evictEntityData(String) and
Cache.evictEntityData()
evictAll in interface CachedDomainDataAccesspublic void destroy()
destroy in interface AbstractDomainDataRegion.DestructibleCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.