|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.services.persondir.support.BasePersonAttributeDao
org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
org.jasig.services.persondir.support.CachingPersonAttributeDaoImpl
public class CachingPersonAttributeDaoImpl
A configurable caching implementation of IPersonAttributeDao
which caches results from a wrapped IPersonAttributeDao.
Configuration:
| 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 |
| Field Summary | |
|---|---|
protected static Set<IPersonAttributes> |
NULL_RESULTS_OBJECT
|
protected org.apache.commons.logging.Log |
statsLogger
|
| Fields inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao |
|---|
logger |
| Fields inherited from interface org.jasig.services.persondir.IPersonAttributeDao |
|---|
WILDCARD, WILDCARD_PATTERN |
| Constructor Summary | |
|---|---|
CachingPersonAttributeDaoImpl()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao |
|---|
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMap |
| Methods inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao |
|---|
getPeople, toMultivaluedSeed |
| Methods inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao |
|---|
flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getUserAttributes, getUserAttributes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Set<IPersonAttributes> NULL_RESULTS_OBJECT
protected org.apache.commons.logging.Log statsLogger
| Constructor Detail |
|---|
public CachingPersonAttributeDaoImpl()
| Method Detail |
|---|
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 applicable
cacheKeyAttributes - 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.BeanNameAware
public 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)
#getCacheKey(Map).
getPeopleWithMultivaluedAttributes in interface IPersonAttributeDaoIPersonAttributeDao.getPeopleWithMultivaluedAttributes(java.util.Map)public void removeUserAttributes(String uid)
public void removeUserAttributes(Map<String,Object> seed)
public void removeUserAttributesMultivaluedSeed(Map<String,List<Object>> seed)
public Set<String> getPossibleUserAttributeNames()
getPossibleUserAttributeNames in interface IPersonAttributeDaopublic Set<String> getAvailableQueryAttributes()
getAvailableQueryAttributes in interface IPersonAttributeDao
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||