|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.kew.util.CachingInterceptor
public class CachingInterceptor
This is a generic caching proxy for KEW, using the cache administrator service to store results. It's inteded for caching query results for a DAO, but it likely has broader use.
It will cache the results of calls matching method names which are set in setCacheForMethods(java.lang.String[])
.
It will clear this "cache group" for calls with matching method names set in setClearCacheOnMethods(java.lang.String[])
.
The cache group name (see setCacheGroupName(String)
) in most instances should unique for each class that
is proxied.
Configuration should be done through Spring, probably using BeanNameAutoProxyCreator.
NOTE: One important assumption here is that the arguments for the methods being cached will all have
Object.toString()
implementations such that o1.equals(o2) iff o1.toString().equals(o2.toString()).
Field Summary | |
---|---|
private Set<String> |
cacheForMethods
|
private String |
cacheGroupName
|
private Set<String> |
clearCacheOnMethods
|
private static org.apache.commons.logging.Log |
LOG
|
private static Object |
NULL_OBJECT
|
Constructor Summary | |
---|---|
CachingInterceptor()
|
Method Summary | |
---|---|
private String |
getCacheKey(String methodName,
Object[] args)
build a cache key based on the method name and the parameters |
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
This overridden method intercepts calls, and if the intercepted method is in clearCacheOnMethods the cache is purged, then the method is called and any results returned. if the intercepted method is in cacheForMethods the cache is checked. |
void |
setCacheForMethods(String[] methods)
|
void |
setCacheGroupName(String name)
|
void |
setClearCacheOnMethods(String[] methods)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log LOG
private Set<String> clearCacheOnMethods
private Set<String> cacheForMethods
private String cacheGroupName
private static final Object NULL_OBJECT
Constructor Detail |
---|
public CachingInterceptor()
Method Detail |
---|
public void setClearCacheOnMethods(String[] methods)
public void setCacheForMethods(String[] methods)
public void setCacheGroupName(String name)
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
private String getCacheKey(String methodName, Object[] args)
methodName
- args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |