Class TransactionAwareCacheManagerProxy
java.lang.Object
org.springframework.cache.transaction.TransactionAwareCacheManagerProxy
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,org.springframework.cache.CacheManager
public class TransactionAwareCacheManagerProxy
extends Object
implements org.springframework.cache.CacheManager, org.springframework.beans.factory.InitializingBean
Proxy for a target
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.- Since:
- 3.2
- Author:
- Juergen Hoeller
- See Also:
-
setTargetCacheManager(org.springframework.cache.CacheManager)
TransactionAwareCacheDecorator
TransactionSynchronizationManager
-
Constructor Summary
ConstructorDescriptionCreate a new TransactionAwareCacheManagerProxy, setting the target CacheManager through thesetTargetCacheManager(org.springframework.cache.CacheManager)
bean property.TransactionAwareCacheManagerProxy
(org.springframework.cache.CacheManager targetCacheManager) Create a new TransactionAwareCacheManagerProxy for the given target CacheManager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
org.springframework.cache.Cache
void
setTargetCacheManager
(org.springframework.cache.CacheManager targetCacheManager) Set the target CacheManager to proxy.
-
Constructor Details
-
TransactionAwareCacheManagerProxy
public TransactionAwareCacheManagerProxy()Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager through thesetTargetCacheManager(org.springframework.cache.CacheManager)
bean property. -
TransactionAwareCacheManagerProxy
public TransactionAwareCacheManagerProxy(org.springframework.cache.CacheManager targetCacheManager) Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.- Parameters:
targetCacheManager
- the target CacheManager to proxy
-
-
Method Details
-
setTargetCacheManager
public void setTargetCacheManager(org.springframework.cache.CacheManager targetCacheManager) Set the target CacheManager to proxy. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getCache
- Specified by:
getCache
in interfaceorg.springframework.cache.CacheManager
-
getCacheNames
- Specified by:
getCacheNames
in interfaceorg.springframework.cache.CacheManager
-