Yes, I would be interested see result caching cabability on ldaptempalte. Any ideas how this could be done?
Printable View
Yes, I would be interested see result caching cabability on ldaptempalte. Any ideas how this could be done?
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.
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.
So as you can see, I've got a dao class, that wraps nicely that ldaptemplate.Code:
<!-- The created cache manager is an instance of net.sf.ehcache.CacheManager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" >
<property name="configLocation"><value>classpath:ehcache.xml</value></property>
</bean>
<bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
<property name="cacheManager" ref="cacheManager" />
</bean>
<bean id="myLdapDAO" class="org.springmodules.cache.interceptor.proxy.CacheProxyFactoryBean">
<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>
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!
hiiiii thanks for the code ...but i am in little bit confuse....
i dont know the code where to apply and my code is in bean.xml ....
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
<property name="contextSource" ref="contextSource" />
</bean>
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapC ontextSource">
<property name="url" value="url/>"
<property name="userDn" value="uid=admin,ou=system" />
<property name="password" value="system" />
<property name="pooled" value="false" />
</bean>
<bean name="ldapOfficeServiceImpl" class="com.iton.ioffice.admin.services.impl.LdapOf ficeServiceImpl">
<property name="ldapOfficeDao" ref="ldapOfficeDaoImpl"></property>
</bean>
<bean name="ldapOfficeDaoImpl" class="com.iton.ioffice.admin.DAO.impl.LdapOfficeD aoImpl">
<property name="ldapTemplate" ref="ldapTemplate"></property>
</bean>
<bean name="ldapUserDaoImpl" class="com.iton.ioffice.admin.DAO.impl.LdapUserDao Impl">
<property name="ldapTemplate" ref="ldapTemplate"></property>
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
<bean name="ldapUserServiceImpl" class="com.iton.ioffice.admin.services.impl.LdapUs erServiceImpl">
<property name="ldapUserDao" ref="ldapUserDaoImpl"></property>
</bean>*/*******
this is thec ode where i used to use the ldap