Class JCacheAspectSupport
java.lang.Object
org.springframework.cache.interceptor.AbstractCacheInvoker
org.springframework.cache.jcache.interceptor.JCacheAspectSupport
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
JCacheInterceptor
public class JCacheAspectSupport
extends org.springframework.cache.interceptor.AbstractCacheInvoker
implements org.springframework.beans.factory.InitializingBean
Base class for JSR-107 caching aspects, such as the
JCacheInterceptor
or an AspectJ aspect.
Use the Spring caching abstraction for cache-related operations. No JSR-107
Cache or CacheManager are required to
process standard JSR-107 cache annotations.
The JCacheOperationSource is used for determining caching operations
A cache aspect is serializable if its JCacheOperationSource is serializable.
- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
-
CacheAspectSupportKeyGeneratorAdapterCacheResolverAdapter
-
Field Summary
FieldsFields inherited from class org.springframework.cache.interceptor.AbstractCacheInvoker
errorHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected Objectexecute(org.springframework.cache.interceptor.CacheOperationInvoker invoker, Object target, Method method, Object[] args) Return the CacheOperationSource for this cache aspect.protected ObjectinvokeOperation(org.springframework.cache.interceptor.CacheOperationInvoker invoker) Execute the underlying operation (typically in case of cache miss) and return the result of the invocation.voidsetCacheOperationSource(JCacheOperationSource cacheOperationSource) Set the CacheOperationSource for this cache aspect.Methods inherited from class org.springframework.cache.interceptor.AbstractCacheInvoker
doClear, doEvict, doGet, doGet, doPut, doRetrieve, doRetrieve, getErrorHandler, setErrorHandler
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
JCacheAspectSupport
public JCacheAspectSupport()
-
-
Method Details
-
setCacheOperationSource
Set the CacheOperationSource for this cache aspect. -
getCacheOperationSource
Return the CacheOperationSource for this cache aspect. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
execute
-
invokeOperation
@Nullable protected Object invokeOperation(org.springframework.cache.interceptor.CacheOperationInvoker invoker) Execute the underlying operation (typically in case of cache miss) and return the result of the invocation. If an exception occurs it will be wrapped in aThrowableWrapper: the exception can be handled or modified but it must be wrapped in aThrowableWrapperas well.- Parameters:
invoker- the invoker handling the operation being cached- Returns:
- the result of the invocation
- See Also:
-
CacheOperationInvoker.invoke()
-