public class AttributeBasedCacheKeyGenerator extends Object implements org.springmodules.cache.key.CacheKeyGenerator
Method 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| Modifier and Type | Class and Description |
|---|---|
static class |
AttributeBasedCacheKeyGenerator.CachableMethod
Methods on
IPersonAttributeDao that are cachable |
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
AttributeBasedCacheKeyGenerator() |
| Modifier and Type | Method and Description |
|---|---|
Serializable |
generateKey(org.aopalliance.intercept.MethodInvocation methodInvocation) |
Set<String> |
getCacheKeyAttributes() |
String |
getDefaultAttributeName() |
protected Integer |
getKeyHash(Map<String,Object> seed)
Gets the hash of the key elements from the seed
Map. |
protected Map<String,Object> |
getSeed(Object[] methodArguments,
AttributeBasedCacheKeyGenerator.CachableMethod cachableMethod)
Get the see
Map that was passed to the AttributeBasedCacheKeyGenerator.CachableMethod. |
boolean |
isIgnoreEmptyAttributes()
Returns boolean indicating whether seed attributes with empty values (null, empty string or empty list values)
should be ignored when generating the cache key
|
boolean |
isUseAllAttributes() |
protected AttributeBasedCacheKeyGenerator.CachableMethod |
resolveCacheableMethod(org.aopalliance.intercept.MethodInvocation methodInvocation)
Iterates over the
AttributeBasedCacheKeyGenerator.CachableMethod instances to determine which instance the
passed MethodInvocation applies to. |
void |
setCacheKeyAttributes(Set<String> cacheKeyAttributes) |
void |
setDefaultAttributeName(String defaultAttributeName) |
void |
setIgnoreEmptyAttributes(boolean ignoreEmptyAttributes)
If seed attributes with empty values (null, empty string or empty list values) should be ignored when generating
the cache key.
|
void |
setUseAllAttributes(boolean useAllAttributes)
If all seed attributes should be used.
|
public void setCacheKeyAttributes(Set<String> cacheKeyAttributes)
cacheKeyAttributes - the cacheKeyAttributes to setpublic String getDefaultAttributeName()
public void setDefaultAttributeName(String defaultAttributeName)
defaultAttributeName - the defaultAttributeName to setpublic boolean isUseAllAttributes()
public void setUseAllAttributes(boolean useAllAttributes)
useAllAttributes - True to use all attributespublic boolean isIgnoreEmptyAttributes()
public void setIgnoreEmptyAttributes(boolean ignoreEmptyAttributes)
ignoreEmptyAttributes - True to ignore attributes with empty valuespublic Serializable generateKey(org.aopalliance.intercept.MethodInvocation methodInvocation)
generateKey in interface org.springmodules.cache.key.CacheKeyGeneratorprotected Map<String,Object> getSeed(Object[] methodArguments, AttributeBasedCacheKeyGenerator.CachableMethod cachableMethod)
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.methodArguments - The method argumentscachableMethod - The targeted cachable methodprotected Integer getKeyHash(Map<String,Object> seed)
Map. The key elements are specified by
the cacheKeyAttributes Set or if it is null the
defaultAttributeName is used as the key attribute.seed - Seedprotected AttributeBasedCacheKeyGenerator.CachableMethod resolveCacheableMethod(org.aopalliance.intercept.MethodInvocation methodInvocation)
AttributeBasedCacheKeyGenerator.CachableMethod instances to determine which instance the
passed MethodInvocation applies to.methodInvocation - method invocationCopyright © 2015 Jasig. All Rights Reserved.