org.kuali.rice.kew.useroptions
Class UserOptionsServiceCache.ClusterSafeMethodCache

java.lang.Object
  extended by org.kuali.rice.kew.useroptions.UserOptionsServiceCache.ClusterSafeMethodCache
Enclosing class:
UserOptionsServiceCache

private static class UserOptionsServiceCache.ClusterSafeMethodCache
extends Object

a helper class to encapsulate cluster safe cache functionality

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

Field Summary
 String cachedServiceName
           
static Object NULL_OBJECT
           
 
Constructor Summary
UserOptionsServiceCache.ClusterSafeMethodCache(String cachedServiceName)
          This constructs a ClusterSaveMethodCache
 
Method Summary
 void clearCacheEntry(String principalId, String methodName, Object... keySource)
          This method clears a cache entry for a given method call / arguments combination
 void clearCacheGroup(String principalId)
          This method clears all cached calls for the given principal
private  String getCacheGroup(String principalId)
          This method gets the cache group name (an entire cache group can be cleared at once)
private  String getCacheKey(String principalId, String methodName, Object... args)
          build a cache key based on the user, method name and the parameters
 Object getFromCache(String principalId, String methodName, Object... keySource)
          retrieves a method result from the cache.
 void putInCache(String principalId, String methodName, Object value, Object... keySource)
          caches a method result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_OBJECT

public static final Object NULL_OBJECT

cachedServiceName

public final String cachedServiceName
Constructor Detail

UserOptionsServiceCache.ClusterSafeMethodCache

public UserOptionsServiceCache.ClusterSafeMethodCache(String cachedServiceName)
This constructs a ClusterSaveMethodCache

Parameters:
cachedServiceName - a name for the service being cached
Method Detail

getCacheKey

private String getCacheKey(String principalId,
                           String methodName,
                           Object... args)
build a cache key based on the user, method name and the parameters

Parameters:
methodName -
args -
Returns:

putInCache

public void putInCache(String principalId,
                       String methodName,
                       Object value,
                       Object... keySource)
caches a method result

Parameters:
principalId - the principal for whom the call is being cached
methodName - the name of the method whose result is being cached
value -
keySource - the parameters to the method call that is being cached. These are used to build the cache key, so order is important.

getFromCache

public Object getFromCache(String principalId,
                           String methodName,
                           Object... keySource)
retrieves a method result from the cache. If the static final NULL_OBJECT is returned then the cached result was null.

Parameters:
principalId - the principal for whom the call is being cached
methodName - the name of the method whose result is being cached
keySource - the parameters to the method call that is being cached. These are used to build the cache key, so order is important.
Returns:

clearCacheGroup

public void clearCacheGroup(String principalId)
This method clears all cached calls for the given principal

Parameters:
principalId - the principal for whom the cache is being cleared

clearCacheEntry

public void clearCacheEntry(String principalId,
                            String methodName,
                            Object... keySource)
This method clears a cache entry for a given method call / arguments combination

Parameters:
principalId - the principal for whom the cache entry is being cleared
methodName - the name of the method whose result is being cached
keySource - the parameters to the method call that is being cached. These are used to build the cache key, so order is important.

getCacheGroup

private String getCacheGroup(String principalId)
This method gets the cache group name (an entire cache group can be cleared at once)

Parameters:
principalId - the principal whose cache group name is being generated
Returns:
the cache group name


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