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 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() |
Set<String> |
getAvailableQueryAttributes() |
IPersonAttributeDao |
getCachedPersonAttributesDao() |
Set<String> |
getCacheKeyAttributes()
Deprecated.
these should be retrieved from the provided
CacheKeyGenerator if applicable |
org.springmodules.cache.key.CacheKeyGenerator |
getCacheKeyGenerator() |
long |
getMisses() |
Set<IPersonAttributes> |
getNullResultsObject() |
Set<IPersonAttributes> |
getPeopleWithMultivaluedAttributes(Map<String,List<Object>> seed)
Wraps the call to the specified cachedPersonAttributesDao IPersonAttributeDao delegate with
a caching layer.
|
Set<String> |
getPossibleUserAttributeNames() |
long |
getQueries() |
Map<Serializable,Set<IPersonAttributes>> |
getUserInfoCache() |
boolean |
isCacheNullResults() |
void |
removeUserAttributes(Map<String,Object> seed) |
void |
removeUserAttributes(String uid) |
void |
removeUserAttributesMultivaluedSeed(Map<String,List<Object>> seed) |
void |
setBeanName(String name) |
void |
setCachedPersonAttributesDao(IPersonAttributeDao cachedPersonAttributesDao)
The IPersonAttributeDao to cache results from.
|
void |
setCacheKeyAttributes(Set<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(Set<IPersonAttributes> nullResultsObject)
Used to specify the placeholder object to put in the cache for null results.
|
void |
setUserInfoCache(Map<Serializable,Set<IPersonAttributes>> userInfoCache)
The Map to use for caching results.
|
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMapgetPeople, toMultivaluedSeedflattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getUserAttributes, getUserAttributesprotected static final 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 Set<String> getCacheKeyAttributes()
CacheKeyGenerator if applicable@Deprecated public void setCacheKeyAttributes(Set<String> cacheKeyAttributes)
CacheKeyGenerator if applicablecacheKeyAttributes - The cacheKeyAttributes to set.public Map<Serializable,Set<IPersonAttributes>> getUserInfoCache()
public void setUserInfoCache(Map<Serializable,Set<IPersonAttributes>> userInfoCache)
userInfoCache - The userInfoCache to set.public boolean isCacheNullResults()
public void setCacheNullResults(boolean cacheNullResults)
cacheNullResults - the cacheNullResults to setpublic Set<IPersonAttributes> getNullResultsObject()
public void setNullResultsObject(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(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic long getMisses()
public long getQueries()
public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(Map<String,List<Object>> seed)
getCacheKeyGenerator().getPeopleWithMultivaluedAttributes in interface IPersonAttributeDaoIPersonAttributeDao.getPeopleWithMultivaluedAttributes(java.util.Map)public void removeUserAttributes(String uid)
public void removeUserAttributesMultivaluedSeed(Map<String,List<Object>> seed)
public Set<String> getPossibleUserAttributeNames()
getPossibleUserAttributeNames in interface IPersonAttributeDaopublic Set<String> getAvailableQueryAttributes()
getAvailableQueryAttributes in interface IPersonAttributeDaoCopyright © 2015 Jasig. All Rights Reserved.