public class CachingPersonAttributeDaoImpl extends AbstractDefaultAttributePersonAttributeDao implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanNameAware
IPersonAttributeDao
which caches results from a wrapped IPersonAttributeDao.
| Property | Description | Required | Default |
|---|---|---|---|
| cachedPersonAttributesDao |
The IPersonAttributeDao to delegate
queries to on cache misses.
|
Yes | null |
| userInfoCache |
The Map to use for result caching. This class does no cache
maintenence. It is assumed the underlying Map implementation will ensure the cache
is in a good state at all times.
|
Yes | null |
| cacheKeyAttributes | A Set of attribute names to use when building the cache key. The default implementation generates the key as a Map of attributeNames to values retrieved from the seed for the query. Zero length sets are treaded as null. | No | null |
| cacheNullResults | If the wrapped IPersonAttributeDao returns null for the query should that null value be stored in the cache. | No | false |
| nullResultsObject | If cacheNullResults is set to true this value is stored in the cache for any query that returns null. This is used as a flag so the same query will return null from the cache by seeing this value | No | NULL_RESULTS_OBJECT |
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.Set<IPersonAttributes> |
NULL_RESULTS_OBJECT |
protected org.apache.commons.logging.Log |
statsLogger |
loggerWILDCARD, WILDCARD_PATTERN| Constructor and Description |
|---|
CachingPersonAttributeDaoImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
java.util.Set<java.lang.String> |
getAvailableQueryAttributes() |
IPersonAttributeDao |
getCachedPersonAttributesDao() |
java.util.Set<java.lang.String> |
getCacheKeyAttributes()
Deprecated.
these should be retrieved from the provided
CacheKeyGenerator if applicable |
org.springmodules.cache.key.CacheKeyGenerator |
getCacheKeyGenerator() |
long |
getMisses() |
java.util.Set<IPersonAttributes> |
getNullResultsObject() |
java.util.Set<IPersonAttributes> |
getPeopleWithMultivaluedAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> seed)
Wraps the call to the specified cachedPersonAttributesDao IPersonAttributeDao delegate with
a caching layer.
|
java.util.Set<java.lang.String> |
getPossibleUserAttributeNames() |
long |
getQueries() |
java.util.Map<java.io.Serializable,java.util.Set<IPersonAttributes>> |
getUserInfoCache() |
boolean |
isCacheNullResults() |
void |
removeUserAttributes(java.util.Map<java.lang.String,java.lang.Object> seed) |
void |
removeUserAttributes(java.lang.String uid) |
void |
removeUserAttributesMultivaluedSeed(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> seed) |
void |
setBeanName(java.lang.String name) |
void |
setCachedPersonAttributesDao(IPersonAttributeDao cachedPersonAttributesDao)
The IPersonAttributeDao to cache results from.
|
void |
setCacheKeyAttributes(java.util.Set<java.lang.String> cacheKeyAttributes)
Deprecated.
these should be set on the provided
CacheKeyGenerator if applicable |
void |
setCacheKeyGenerator(org.springmodules.cache.key.CacheKeyGenerator cacheKeyGenerator)
The CacheKeyGenerator to use for generating cache keys.
|
void |
setCacheNullResults(boolean cacheNullResults)
If null results should be cached to avoid repeating failed lookups.
|
void |
setNullResultsObject(java.util.Set<IPersonAttributes> nullResultsObject)
Used to specify the placeholder object to put in the cache for null results.
|
void |
setUserInfoCache(java.util.Map<java.io.Serializable,java.util.Set<IPersonAttributes>> userInfoCache)
The Map to use for caching results.
|
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMapgetPeople, toMultivaluedSeedcompareTo, flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getOrder, getUserAttributes, getUserAttributes, setOrderprotected static final java.util.Set<IPersonAttributes> NULL_RESULTS_OBJECT
protected org.apache.commons.logging.Log statsLogger
public IPersonAttributeDao getCachedPersonAttributesDao()
public void setCachedPersonAttributesDao(IPersonAttributeDao cachedPersonAttributesDao)
cachedPersonAttributesDao - The cachedPersonAttributesDao to set.@Deprecated public java.util.Set<java.lang.String> getCacheKeyAttributes()
CacheKeyGenerator if applicable@Deprecated public void setCacheKeyAttributes(java.util.Set<java.lang.String> cacheKeyAttributes)
CacheKeyGenerator if applicablecacheKeyAttributes - The cacheKeyAttributes to set.public java.util.Map<java.io.Serializable,java.util.Set<IPersonAttributes>> getUserInfoCache()
public void setUserInfoCache(java.util.Map<java.io.Serializable,java.util.Set<IPersonAttributes>> userInfoCache)
userInfoCache - The userInfoCache to set.public boolean isCacheNullResults()
public void setCacheNullResults(boolean cacheNullResults)
cacheNullResults - the cacheNullResults to setpublic java.util.Set<IPersonAttributes> getNullResultsObject()
public void setNullResultsObject(java.util.Set<IPersonAttributes> nullResultsObject)
nullResultsObject - the nullResultsObject to setpublic org.springmodules.cache.key.CacheKeyGenerator getCacheKeyGenerator()
public void setCacheKeyGenerator(org.springmodules.cache.key.CacheKeyGenerator cacheKeyGenerator)
cacheKeyGenerator - the cacheKeyGenerator to setpublic void setBeanName(java.lang.String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic long getMisses()
public long getQueries()
public java.util.Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> seed)
getCacheKeyGenerator().getPeopleWithMultivaluedAttributes in interface IPersonAttributeDaoIPersonAttributeDao.getPeopleWithMultivaluedAttributes(java.util.Map)public void removeUserAttributes(java.lang.String uid)
public void removeUserAttributes(java.util.Map<java.lang.String,java.lang.Object> seed)
public void removeUserAttributesMultivaluedSeed(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> seed)
public java.util.Set<java.lang.String> getPossibleUserAttributeNames()
getPossibleUserAttributeNames in interface IPersonAttributeDaopublic java.util.Set<java.lang.String> getAvailableQueryAttributes()
getAvailableQueryAttributes in interface IPersonAttributeDaoCopyright © 2005-2018. All Rights Reserved.