org.jasig.services.persondir.support
Class AttributeBasedCacheKeyGenerator
java.lang.Object
org.jasig.services.persondir.support.AttributeBasedCacheKeyGenerator
- All Implemented Interfaces:
- org.springmodules.cache.key.CacheKeyGenerator
public class AttributeBasedCacheKeyGenerator
- extends Object
- implements org.springmodules.cache.key.CacheKeyGenerator
Generates a cache key using a hash of the AttributeBasedCacheKeyGenerator.CachableMethod being called and for
IPersonAttributeDao.getMultivaluedUserAttributes(String) and
IPersonAttributeDao.getUserAttributes(String) the String uid or for
IPersonAttributeDao.getMultivaluedUserAttributes(Map) and
IPersonAttributeDao.getUserAttributes(Map) attributes from the seed Map
as specified by the cacheKeyAttributes Set
- Version:
- $Revision$
- Author:
- Eric Dalquist
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final Log logger
AttributeBasedCacheKeyGenerator
public AttributeBasedCacheKeyGenerator()
getCacheKeyAttributes
public Set<String> getCacheKeyAttributes()
- Returns:
- the cacheKeyAttributes
setCacheKeyAttributes
public void setCacheKeyAttributes(Set<String> cacheKeyAttributes)
- Parameters:
cacheKeyAttributes - the cacheKeyAttributes to set
getDefaultAttributeName
public String getDefaultAttributeName()
- Returns:
- the defaultAttributeName
setDefaultAttributeName
public void setDefaultAttributeName(String defaultAttributeName)
- Parameters:
defaultAttributeName - the defaultAttributeName to set
generateKey
public Serializable generateKey(org.aopalliance.intercept.MethodInvocation methodInvocation)
- Specified by:
generateKey in interface org.springmodules.cache.key.CacheKeyGenerator
getSeed
protected Map<String,Object> getSeed(Object[] methodArguments,
AttributeBasedCacheKeyGenerator.CachableMethod cachableMethod)
- Get the see
Map that was passed to the AttributeBasedCacheKeyGenerator.CachableMethod. For AttributeBasedCacheKeyGenerator.CachableMethods that
take String arguments this method is responsible for converting it into a Map using the
defaultAttributeName.
- Parameters:
methodArguments - The method argumentscachableMethod - The targeted cachable method
- Returns:
- The seed Map for the method call
getKeyHash
protected int getKeyHash(Map<String,Object> seed)
- Gets the hash of the key elements from the seed
Map. The key elements are specified by
the cacheKeyAttributes Set or if it is null the
defaultAttributeName is used as the key attribute.
resolveCacheableMethod
protected AttributeBasedCacheKeyGenerator.CachableMethod resolveCacheableMethod(org.aopalliance.intercept.MethodInvocation methodInvocation)
- Iterates over the
AttributeBasedCacheKeyGenerator.CachableMethod instances to determine which instance the
passed MethodInvocation applies to.
Copyright © 1998-2008 Java Architectures Special Interest Group. All Rights Reserved.