org.kuali.rice.kew.util
Class CachingInterceptor

java.lang.Object
  extended by org.kuali.rice.kew.util.CachingInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class CachingInterceptor
extends Object
implements org.aopalliance.intercept.MethodInterceptor

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()).

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
CachingInterceptor()
           
 
Method Summary
 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
 

Constructor Detail

CachingInterceptor

public CachingInterceptor()
Method Detail

setClearCacheOnMethods

public void setClearCacheOnMethods(String[] methods)

setCacheForMethods

public void setCacheForMethods(String[] methods)

setCacheGroupName

public void setCacheGroupName(String name)

invoke

public Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
              throws Throwable
This overridden method intercepts calls, and

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
Throwable
See Also:
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.