
Originally Posted by
Ben Alex
If I were starting a new project, I'd use Spring's new org.springframework.cache.ehcache package. Acegi Security will be depreciating its implementations in favour for this package once it's in a Spring core release.
Thanks Ben. I took irboubo advise and got the package you metioned from CVS. I also updated my AGEGI provider to use it. Work fine so far.
Code:
<!-- ##################################################### -->
<!-- ################## Ehcache setup #################### -->
<!-- ##################################################### -->
<bean name="mwEhcacheMgr" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>/WEB-INF/ehcache.xml</value>
</property>
</bean>
<bean name="WBSCacheFB" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref bean="mwEhcacheMgr" />
</property>
<property name="cacheName">
<value>WBSCache</value>
</property>
</bean>
<bean name="UserCacheFB" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref bean="mwEhcacheMgr" />
</property>
<property name="cacheName">
<value>UserCache</value>
</property>
</bean>
<bean id="userCache" class="com.method.util.EhCacheBasedUserCache">
<property name="cache">
<ref bean="UserCacheFB" />
</property>
</bean>
<bean id="wbsCache" class="com.method.util.WBSCache">
<property name="cache">
<ref bean="WBSCacheFB" />
</property>
</bean>
Code:
<bean id="mwAuthenticationProvider" class="com.method.security.MWAuthenticationProvider">
<property name="userCache">
<ref bean="userCache" />
</property>
<property name="authenticationDao">
<ref bean="methodDao" />
</property>
</bean>
Code:
<bean id="showWBSController" class="com.method.web.browse.xslt.ShowWBSController">
<property name="methodNameResolver">
<ref local="showWBSControllerResolver" />
</property>
<property name="methodDBFacade">
<ref bean="methodDBFacade" />
</property>
<property name="pathMapping">
<ref local="pathMapping" />
</property>
<property name="wbsCache">
<ref bean="wbsCache" />
</property>
</bean>
ehcache.xml
Code:
<cache name="WBSCache"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="124416000"
timeToLiveSeconds="124416000"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
/>
<cache name="UserCache"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="300"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
/>