public class TransactionAwareCacheManagerProxy extends Object implements CacheManager, InitializingBean
CacheManager, exposing transaction-aware Cache objects
which synchronize their Cache.put(java.lang.Object, java.lang.Object) operations with Spring-managed transactions
(through Spring's TransactionSynchronizationManager,
performing the actual cache put operation only in the after-commit phase of a successful transaction.
If no transaction is active, Cache.put(java.lang.Object, java.lang.Object) operations will be performed immediately, as usual.setTargetCacheManager(org.springframework.cache.CacheManager),
TransactionAwareCacheDecorator,
TransactionSynchronizationManager| Constructor and Description |
|---|
TransactionAwareCacheManagerProxy()
Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager
through the
setTargetCacheManager(org.springframework.cache.CacheManager) bean property. |
TransactionAwareCacheManagerProxy(CacheManager targetCacheManager)
Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc. |
Cache |
getCache(String name)
Return the cache associated with the given name.
|
Collection<String> |
getCacheNames()
Return a collection of the cache names known by this manager.
|
void |
setTargetCacheManager(CacheManager targetCacheManager)
Set the target CacheManager to proxy.
|
public TransactionAwareCacheManagerProxy()
setTargetCacheManager(org.springframework.cache.CacheManager) bean property.public TransactionAwareCacheManagerProxy(CacheManager targetCacheManager)
targetCacheManager - the target CacheManager to proxypublic void setTargetCacheManager(CacheManager targetCacheManager)
public void afterPropertiesSet()
InitializingBeanBeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
afterPropertiesSet in interface InitializingBean@Nullable public Cache getCache(String name)
CacheManagergetCache in interface CacheManagername - the cache identifier (must not be null)null if none foundpublic Collection<String> getCacheNames()
CacheManagergetCacheNames in interface CacheManager