API Note
Note that the following methods are not considered "transactional"
in this sense: contains, lockRegion, unlockRegion,
evict, evictAll. The semantics of these methods come from
JPA's Cache contract.
Implementation Specification
The "non-transactional" methods noted in the @apiNote
should be implemented to ignore any locking. That is, when evict
is called, the item should be forcibly removed from the cache regardless of
whether anything has locked it.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | |
| public void | evictAll()
Forcibly evict all items from the cache immediately without regard for transaction isolation. |
| public Object | Returns: the cached data ornullCurrent session. session, Object The key of the item to be retrieved. key)Attempt to retrieve an object from the cache. |
| public AccessType | |
| public DomainDataRegion | |
| public SoftLock | Returns: A representation of our lock on the item; ornull.Current session. session, Object The key of the item to lock key, Object The item's current version value version)We are going to attempt to update/delete the keyed object. |
| public SoftLock | |
| public boolean | Returns: true if the object was successfully cachedCurrent session. session, Object The item key key, Object The item value, Object the item version number version)Attempt to cache an object, afterQuery loading from the database. |
| public boolean | Returns: true if the object was successfully cachedCurrent session. session, Object The item key key, Object The item value, Object the item version number version, boolean Explicit minimalPut flag minimalPutOverride)Attempt to cache an object, afterQuery loading from the database, explicitly specifying the minimalPut behavior. |
| public void | remove(SharedSessionContractImplementor
Current session. session, Object The key of the item to remove key)Called afterQuery an item has become stale (beforeQuery the transaction completes). |
| public void | |
| public void | unlockItem(SharedSessionContractImplementor
Current session. session, Object The item key key, SoftLock The lock previously obtained from lock)lockItemCalled when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. |
| public void | unlockRegion(SoftLock
The lock previously obtained from lock)lockRegionCalled after we have finished the attempted invalidation of the entire region |
| contains | back to summary |
|---|---|
| public 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.
| |
| evict | back to summary |
|---|---|
| public 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
| |
| evictAll | back to summary |
|---|---|
| public void evictAll() Forcibly 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
| |
| get | back to summary |
|---|---|
| public 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.
| |
| getAccessType | back to summary |
|---|---|
| public AccessType getAccessType() The type of access implemented | |
| getRegion | back to summary |
|---|---|
| public DomainDataRegion getRegion() The region containing the data being accessed | |
| lockItem | back to summary |
|---|---|
| public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) We are going to attempt to update/delete the keyed object. This method is used by "asynchronous" concurrency strategies.
The returned object must be passed back to
| |
| lockRegion | back to summary |
|---|---|
| public SoftLock lockRegion() Lock the entire region
| |
| putFromLoad | back to summary |
|---|---|
| public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version) Attempt to cache an object, afterQuery loading from the database.
| |
| putFromLoad | back to summary |
|---|---|
| public 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.
| |
| remove | back to summary |
|---|---|
| public 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.
| |
| removeAll | back to summary |
|---|---|
| public void removeAll(SharedSessionContractImplementor session) Remove all data for this accessed type
| |
| unlockItem | back to summary |
|---|---|
| public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. This method is used by "asynchronous" concurrency strategies.
| |
| unlockRegion | back to summary |
|---|---|
| public void unlockRegion(SoftLock lock) Called after we have finished the attempted invalidation of the entire region
| |