Top Description Fields Constructors Methods
org.springframework.cache.transaction

public Class TransactionAwareCacheManagerProxy

extends Object
implements CacheManager, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.cache.CacheManager
Imports
java.util.Collection, org.springframework.beans.factory.InitializingBean, org.springframework.cache.Cache, .CacheManager, org.springframework.lang.Nullable, org.springframework.util.Assert

Proxy for a target CacheManager, exposing transaction-aware Cache objects which synchronize their Cache#put operations with Spring-managed transactions (through Spring's org.springframework.transaction.support.TransactionSynchronizationManager), performing the actual cache put operation only in the after-commit phase of a successful transaction. If no transaction is active, Cache#put operations will be performed immediately, as usual.
Author
Juergen Hoeller
Since
3.2
See Also
setTargetCacheManager, TransactionAwareCacheDecorator, org.springframework.transaction.support.TransactionSynchronizationManager

Field Summary

Modifier and TypeField and Description
private CacheManager

Constructor Summary

AccessConstructor and Description
public
TransactionAwareCacheManagerProxy()

Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager through the setTargetCacheManager bean property.

public
TransactionAwareCacheManagerProxy(CacheManager
the target CacheManager to proxy
targetCacheManager
)

Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory 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.

public Cache
getCache(String
the cache identifier (must not be null)
name
)

Implements org.springframework.cache.CacheManager.getCache.

Get the cache associated with the given name.

public Collection<String>
getCacheNames()

Implements org.springframework.cache.CacheManager.getCacheNames.

Get a collection of the cache names known by this manager.

public void
setTargetCacheManager(CacheManager targetCacheManager)

Set the target CacheManager to proxy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

targetCacheManagerback to summary
private CacheManager targetCacheManager
Annotations
@Nullable

Constructor Detail

TransactionAwareCacheManagerProxyback to summary
public TransactionAwareCacheManagerProxy()

Create a new TransactionAwareCacheManagerProxy, setting the target CacheManager through the setTargetCacheManager bean property.

TransactionAwareCacheManagerProxyback to summary
public TransactionAwareCacheManagerProxy(CacheManager targetCacheManager)

Create a new TransactionAwareCacheManagerProxy for the given target CacheManager.

Parameters
targetCacheManager:CacheManager

the target CacheManager to proxy

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory 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.

Annotations
@Override
getCacheback to summary
public Cache getCache(String name)

Implements org.springframework.cache.CacheManager.getCache.

Doc from org.springframework.cache.CacheManager.getCache.

Get the cache associated with the given name.

Note that the cache may be lazily created at runtime if the native provider supports it.

Parameters
name:String

the cache identifier (must not be null)

Returns:Cache

the associated cache, or null if such a cache does not exist or could be not created

Annotations
@Override
@Nullable
getCacheNamesback to summary
public Collection<String> getCacheNames()

Implements org.springframework.cache.CacheManager.getCacheNames.

Doc from org.springframework.cache.CacheManager.getCacheNames.

Get a collection of the cache names known by this manager.

Returns:Collection<String>

the names of all caches known by the cache manager

Annotations
@Override
setTargetCacheManagerback to summary
public void setTargetCacheManager(CacheManager targetCacheManager)

Set the target CacheManager to proxy.