Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

CachingPersonAttributeDaoImpl

Delegates queries to the configured child IPersonAttributeDao and caches the results based using a key generated from the query using attributes specified in the configuration.

Setting up a CachingPersonAttributeDaoImpl in Spring to would look like the following:

<bean id="cachingPersonAttributeDao" class="org.jasig.services.persondir.support.CachingPersonAttributeDaoImpl">
    <property name="cachedPersonAttributesDao" ref="mergingPersonAttributeDao" />
    <property name="userInfoCache" ref="userInfoCacheMap" />
    <property name="cacheNullResults" value="true" />
</bean>

This configuration will cache results of method calls on mergingPersonAttributeDao in userInfoCacheMap. The cache keys are generated using AttributeBasedCacheKeyGenerator by default and in the default configuration the username attribute is used for the key. Also null results will be cached, meaning if a query against mergingPersonAttributeDao is a miss or cannot be run (null returned) an marker will be cached to avoid repeated null lookups.

Configuration

LdapPersonAttributeDao has an anonymous contstructor.

Property

Type

Default Value

 

defaultAttribute

String

username

The attribute name to use for calls to IPerson getPerson(String). A query Map is generated for these calls using the defaultAttribute and the value passed in.

cachedPersonAttributesDao

IPersonAttributeDao

null

The IPersonAttributeDao to cache results from.

cacheKeyGenerator

CacheKeyGenerator

new AttributeBasedCacheKeyGenerator()

An implementation of the Spring-Modules Caching CacheKeyGenerator API to use to generate cache keys. The use of this interface also allows AOP based caching using the CacheKeyGenerator implementation directly.

userInfoCache

Map<Serializable, Set<IPerson>>

null

The cache to store results in. Only the get, set and remove methods are used on the Map interface so most commonly a wrapper around a real caching interface is used.

cacheNullResults

boolean

false

If null results (meaning a child DAO could not complete the query) are returned should they be cached as well to avoid multiple 'failure' lookups.

AttributeBasedCacheKeyGenerator

  • No labels