类 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-awareCacheobjects 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.CachegetCache(String name)Get the cache associated with the given name.Collection<String>getCacheNames()Get a collection of the cache names known by this manager.voidsetTargetCacheManager(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()
从接口复制的说明:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.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
@Nullable public Cache getCache(String name)
从接口复制的说明:CacheManagerGet 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
nullif such a cache does not exist or could be not created
getCacheNames
public Collection<String> getCacheNames()
从接口复制的说明:CacheManagerGet a collection of the cache names known by this manager.- 指定者:
getCacheNames在接口中CacheManager- 返回:
- the names of all caches known by the cache manager