PDA

View Full Version : ldap result caching


kakoni
Oct 26th, 2006, 01:07 AM
Yes, I would be interested see result caching cabability on ldaptempalte. Any ideas how this could be done?

rasky
Oct 26th, 2006, 03:51 AM
The spring-modules project includes support for declarative caching. Using it for caching LDAP results should be no different from using it on any other dao class so I guess it should be pretty straightforward.

kakoni
Oct 26th, 2006, 10:51 AM
Hi Rasky. Man you are quick on your comments;)

Anyway, thanks for the tip, it worked beautifully.
I used CacheProxyFactoryBean to apply caching into my ldap dao.

If somebody is intrested, I can post full config etc + details.

marcio
Nov 15th, 2006, 11:10 AM
Hi Rasky. Man you are quick on your comments;)

Anyway, thanks for the tip, it worked beautifully.
I used CacheProxyFactoryBean to apply caching into my ldap dao.

If somebody is intrested, I can post full config etc + details.

Can you please post your conf? Thanks a lot!

kakoni
Nov 22nd, 2006, 06:50 AM
<!-- The created cache manager is an instance of net.sf.ehcache.CacheManager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFa ctoryBean" >
<property name="configLocation"><value>classpath:ehcache.xml</value></property>
</bean>

<bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFa cade">
<property name="cacheManager" ref="cacheManager" />
</bean>



<bean id="myLdapDAO" class="org.springmodules.cache.interceptor.proxy.CachePro xyFactoryBean">
<property name="cacheProviderFacade" ref="cacheProviderFacade" />
<property name="cachingModels">
<props>
<prop key="getMethod*">cacheName=ldapCache</prop>
</props>
</property>
<property name="target">
<bean class="org.foo.bar.ldapdaoclass">
<property name="ldapTemplate" ref="ldapTemplate" />
</bean>
</property>
</bean>

<bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate">
<constructor-arg ref="contextSource" />
</bean>



So as you can see, I've got a dao class, that wraps nicely that ldaptemplate.

jpreston
Dec 3rd, 2007, 06:35 PM
Where are you injecting/using your "myLdapDAO" bean?

I'm new to both ehcache and the spring ldap. I've got it loading without error, however, its also not caching anything...

Thanks!