public class TransactionAwareCacheDecorator extends Object implements org.springframework.cache.Cache
put(java.lang.Object, java.lang.Object)
and evict(java.lang.Object)
operations with
Spring-managed transactions (through Spring's TransactionSynchronizationManager
,
performing the actual cache put/evict operation only in the after-commit phase of a
successful transaction. If no transaction is active, put(java.lang.Object, java.lang.Object)
and evict(java.lang.Object)
operations will be performed immediately, as usual.TransactionAwareCacheManagerProxy
Constructor and Description |
---|
TransactionAwareCacheDecorator(org.springframework.cache.Cache targetCache)
Create a new TransactionAwareCache for the given target Cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
evict(Object key) |
org.springframework.cache.Cache.ValueWrapper |
get(Object key) |
String |
getName() |
Object |
getNativeCache() |
void |
put(Object key,
Object value) |
public TransactionAwareCacheDecorator(org.springframework.cache.Cache targetCache)
targetCache
- the target Cache to decoratepublic String getName()
getName
in interface org.springframework.cache.Cache
public Object getNativeCache()
getNativeCache
in interface org.springframework.cache.Cache
public org.springframework.cache.Cache.ValueWrapper get(Object key)
get
in interface org.springframework.cache.Cache
public void put(Object key, Object value)
put
in interface org.springframework.cache.Cache
public void evict(Object key)
evict
in interface org.springframework.cache.Cache
public void clear()
clear
in interface org.springframework.cache.Cache