insert -> afterInsertlockItem -> update -> afterUpdatelockItem -> remove -> unlockItem
There is another usage pattern that is used to invalidate entries
after performing "bulk" HQL/SQL operations:
lockRegion -> removeAll -> unlockRegion
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: Were the contents of the cache actual changed by this operation?The item key key, Object The item value, Object The item's version value version)Called after an item has been inserted (after the transaction completes), instead of calling release(). |
| public boolean | Returns: Were the contents of the cache actual changed by this operation?The item key key, Object The item value, Object The item's current version value currentVersion, Object The item's previous version value previousVersion, SoftLock The lock previously obtained from lock)lockItemCalled after an item has been updated (after the transaction completes), instead of calling release(). |
| public void | |
| public void | evictAll()
Forcibly evict all items from the cache immediately without regard for transaction isolation. |
| public Object | |
| public EntityRegion | |
| public boolean | |
| public SoftLock | |
| public SoftLock | |
| public boolean | Returns: true if the object was successfully cachedThe item key key, Object The item value, long a timestamp prior to the transaction start time txTimestamp, Object the item version number version)Attempt to cache an object, after loading from the database. |
| public boolean | Returns: true if the object was successfully cachedThe item key key, Object The item value, long a timestamp prior to the transaction start time txTimestamp, Object the item version number version, boolean Explicit minimalPut flag minimalPutOverride)Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior. |
| public void | |
| public void | |
| public void | unlockItem(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 |
| public boolean | Returns: Were the contents of the cache actual changed by this operation?The item key key, Object The item value, Object The item's current version value currentVersion, Object The item's previous version value previousVersion)Called after an item has been updated (before the transaction completes), instead of calling evict(). |
| afterInsert | back to summary |
|---|---|
| public boolean afterInsert(Object key, Object value, Object version) throws CacheException Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
| |
| afterUpdate | back to summary |
|---|---|
| public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException Called after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
| |
| evict | back to summary |
|---|---|
| public void evict(Object key) throws CacheException Forcibly evict an item from the cache immediately without regard for transaction isolation.
| |
| evictAll | back to summary |
|---|---|
| public void evictAll() throws CacheException Forcibly evict all items from the cache immediately without regard for transaction isolation.
| |
| get | back to summary |
|---|---|
| public Object get(Object key, long txTimestamp) throws CacheException Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
| |
| getRegion | back to summary |
|---|---|
| public EntityRegion getRegion() Get the wrapped entity cache region
| |
| insert | back to summary |
|---|---|
| public boolean insert(Object key, Object value, Object version) throws CacheException Called after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
| |
| lockItem | back to summary |
|---|---|
| public SoftLock lockItem(Object key, Object version) throws CacheException 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 release(), to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.
| |
| lockRegion | back to summary |
|---|---|
| public SoftLock lockRegion() throws CacheException Lock the entire region
| |
| putFromLoad | back to summary |
|---|---|
| public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException Attempt to cache an object, after loading from the database.
| |
| putFromLoad | back to summary |
|---|---|
| public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
| |
| remove | back to summary |
|---|---|
| public void remove(Object key) throws CacheException Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.
| |
| removeAll | back to summary |
|---|---|
| public void removeAll() throws CacheException Called to evict data from the entire region
| |
| unlockItem | back to summary |
|---|---|
| public void unlockItem(Object key, SoftLock lock) throws CacheException 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) throws CacheException Called after we have finished the attempted invalidation of the entire region
| |
| update | back to summary |
|---|---|
| public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException Called after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
| |