类 TransactionAwareCacheManagerProxy
- java.lang.Object
- org.springframework.cache.transaction.TransactionAwareCacheManagerProxy
- 所有已实现的接口:
InitializingBean
,CacheManager
public class TransactionAwareCacheManagerProxy extends Object implements CacheManager, InitializingBean
Proxy for a targetCacheManager
, exposing transaction-awareCache
objects which synchronize theirCache.put(java.lang.Object, java.lang.Object)
operations with Spring-managed transactions (through Spring'sTransactionSynchronizationManager
, 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.- 从以下版本开始:
- 3.2
- 作者:
- Juergen Hoeller
- 另请参阅:
setTargetCacheManager(org.springframework.cache.CacheManager)
,TransactionAwareCacheDecorator
,TransactionSynchronizationManager
构造器概要
构造器 构造器 说明 TransactionAwareCacheManagerProxy()
Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager through thesetTargetCacheManager(org.springframework.cache.CacheManager)
bean property.TransactionAwareCacheManagerProxy(CacheManager targetCacheManager)
Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.Cache
getCache(String name)
Get the cache associated with the given name.Collection<String>
getCacheNames()
Get a collection of the cache names known by this manager.void
setTargetCacheManager(CacheManager targetCacheManager)
Set the target CacheManager to proxy.
构造器详细资料
TransactionAwareCacheManagerProxy
public TransactionAwareCacheManagerProxy()
Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager through thesetTargetCacheManager(org.springframework.cache.CacheManager)
bean property.
TransactionAwareCacheManagerProxy
public TransactionAwareCacheManagerProxy(CacheManager targetCacheManager)
Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.- 参数:
targetCacheManager
- the target CacheManager to proxy
方法详细资料
setTargetCacheManager
public void setTargetCacheManager(CacheManager targetCacheManager)
Set the target CacheManager to proxy.
afterPropertiesSet
public void afterPropertiesSet()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,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
在接口中InitializingBean
getCache
public Cache getCache(String name)
从接口复制的说明:CacheManager
Get the cache associated with the given name.Note that the cache may be lazily created at runtime if the native provider supports it.
- 指定者:
getCache
在接口中CacheManager
- 参数:
name
- the cache identifier (must not benull
)- 返回:
- the associated cache, or
null
if such a cache does not exist or could be not created
getCacheNames
public Collection<String> getCacheNames()
从接口复制的说明:CacheManager
Get a collection of the cache names known by this manager.- 指定者:
getCacheNames
在接口中CacheManager
- 返回:
- the names of all caches known by the cache manager