|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.cache.interceptor.CacheAspectSupport
public abstract class CacheAspectSupport
Base class for caching aspects, such as the CacheInterceptor
or an AspectJ aspect.
This enables the underlying Spring caching infrastructure to be used easily to implement an aspect for any aspect system.
Subclasses are responsible for calling methods in this class in the correct order.
Uses the Strategy design pattern. A CacheManager
implementation will perform the actual cache management, and a
CacheOperationSource
is used for determining caching
operations.
A cache aspect is serializable if its CacheManager
and
CacheOperationSource
are serializable.
Nested Class Summary | |
---|---|
protected class |
CacheAspectSupport.CacheOperationContext
|
static interface |
CacheAspectSupport.Invoker
|
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
CacheAspectSupport()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected java.lang.Object |
execute(CacheAspectSupport.Invoker invoker,
java.lang.Object target,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
CacheManager |
getCacheManager()
Return the CacheManager that this cache aspect delegates to. |
CacheOperationSource |
getCacheOperationSource()
Return the CacheOperationSource for this cache aspect. |
protected java.util.Collection<Cache> |
getCaches(CacheOperation operation)
|
KeyGenerator |
getKeyGenerator()
Return the KeyGenerator for this cache aspect, |
protected CacheAspectSupport.CacheOperationContext |
getOperationContext(CacheOperation operation,
java.lang.reflect.Method method,
java.lang.Object[] args,
java.lang.Object target,
java.lang.Class<?> targetClass)
|
protected java.lang.String |
methodIdentification(java.lang.reflect.Method method,
java.lang.Class<?> targetClass)
Convenience method to return a String representation of this Method for use in logging. |
void |
setCacheManager(CacheManager cacheManager)
Set the CacheManager that this cache aspect should delegate to. |
void |
setCacheOperationSources(CacheOperationSource... cacheOperationSources)
Set one or more cache operation sources which are used to find the cache attributes. |
void |
setKeyGenerator(KeyGenerator keyGenerator)
Set the KeyGenerator for this cache aspect. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public CacheAspectSupport()
Method Detail |
---|
public void setCacheManager(CacheManager cacheManager)
public CacheManager getCacheManager()
public void setCacheOperationSources(CacheOperationSource... cacheOperationSources)
CompositeCacheOperationSource
.
cacheOperationSources
- must not be null
public CacheOperationSource getCacheOperationSource()
public void setKeyGenerator(KeyGenerator keyGenerator)
DefaultKeyGenerator
.
public KeyGenerator getKeyGenerator()
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
protected java.lang.String methodIdentification(java.lang.reflect.Method method, java.lang.Class<?> targetClass)
method
- the method we're interested intargetClass
- class the method is on
ClassUtils.getQualifiedMethodName(java.lang.reflect.Method)
protected java.util.Collection<Cache> getCaches(CacheOperation operation)
protected CacheAspectSupport.CacheOperationContext getOperationContext(CacheOperation operation, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object target, java.lang.Class<?> targetClass)
protected java.lang.Object execute(CacheAspectSupport.Invoker invoker, java.lang.Object target, java.lang.reflect.Method method, java.lang.Object[] args)
|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |