com.googlecode.ehcache.annotations.interceptor
Class EhCacheInterceptor
java.lang.Object
com.googlecode.ehcache.annotations.interceptor.EhCacheInterceptor
- All Implemented Interfaces:
- org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
public class EhCacheInterceptor
- extends java.lang.Object
- implements org.aopalliance.intercept.MethodInterceptor
Intercepter that handles invocations on methods annotated with Cacheable or TriggersRemove.
- Version:
- $Revision: 681 $
- Author:
- Eric Dalquist
|
Field Summary |
protected org.slf4j.Logger |
logger
|
|
Method Summary |
protected void |
cacheException(CacheableAttribute cacheableAttribute,
org.aopalliance.intercept.MethodInvocation methodInvocation,
java.io.Serializable key,
java.lang.Throwable t)
Checks CacheableAttribute#getExceptionCache(), if not null the exception will be cached. |
protected void |
checkForCachedException(CacheableAttribute cacheableAttribute,
org.aopalliance.intercept.MethodInvocation methodInvocation,
java.io.Serializable key)
Check if there is a cached exception for the key. |
protected java.io.Serializable |
generateCacheKey(org.aopalliance.intercept.MethodInvocation methodInvocation,
MethodAttribute methodAttribute)
Creates a Serializable cache key from the MethodInvocation and configuration attributes. |
java.lang.Object |
invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
|
void |
setCacheAttributeSource(CacheAttributeSource cacheableAttributeSource)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final org.slf4j.Logger logger
EhCacheInterceptor
public EhCacheInterceptor()
setCacheAttributeSource
public void setCacheAttributeSource(CacheAttributeSource cacheableAttributeSource)
invoke
public final java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation methodInvocation)
throws java.lang.Throwable
- Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
- Throws:
java.lang.Throwable
checkForCachedException
protected void checkForCachedException(CacheableAttribute cacheableAttribute,
org.aopalliance.intercept.MethodInvocation methodInvocation,
java.io.Serializable key)
throws java.lang.Throwable
- Check if there is a cached exception for the key. If there is throw it.
- Parameters:
cacheableAttribute - Configuration for the method invocationkey - The cache key for the method invocation
- Throws:
java.lang.Throwable - The cached throwable
cacheException
protected void cacheException(CacheableAttribute cacheableAttribute,
org.aopalliance.intercept.MethodInvocation methodInvocation,
java.io.Serializable key,
java.lang.Throwable t)
- Checks
CacheableAttribute#getExceptionCache(), if not null the exception will be cached.
- Parameters:
cacheableAttribute - Configuration for the method invocationkey - Cache key for the invocationt - The exception to cache
generateCacheKey
protected java.io.Serializable generateCacheKey(org.aopalliance.intercept.MethodInvocation methodInvocation,
MethodAttribute methodAttribute)
- Creates a
Serializable cache key from the MethodInvocation and configuration attributes.
- Parameters:
methodInvocation - Invocation to build the key formethodAttribute - Configuration for the invoked method
- Returns:
- Generated cache key, must not return null.
Copyright © 2011. All Rights Reserved.