Hi,
I am trying use the spring-modules-cache (0.9 version) with jcs, but it does not work.
I wrote this class:
With this jcs-config.properties:Code:package com; import java.util.ArrayList; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springmodules.cache.annotations.CacheFlush; import org.springmodules.cache.annotations.Cacheable; public class TigerCacheableService { List<String> names = new ArrayList<String>(); public List<String> getNames() { return names; } public void setNames(List<String> names) { this.names = names; } @Cacheable(modelId = "testCaching") public final String getName(int index) { System.out.println("Processing getName"); return names.get(index); } @CacheFlush(modelId = "testFlushing") public final void updateName(int index, String name) { System.out.println("Processing updateName"); } public static void main(String[] args) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/application-context.xml"); TigerCacheableService tigerCacheableService = (TigerCacheableService)applicationContext.getBean("cacheableService"); System.out.println(tigerCacheableService.getName(0)); System.out.println(tigerCacheableService.getName(0)); System.out.println(tigerCacheableService.getName(0)); } }
And with this application-context.xml:Code:jcs.default= jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes jcs.default.cacheattributes.MaxObjects=1000 jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache jcs.default.cacheattributes.UseMemoryShrinker=true jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600 jcs.default.cacheattributes.ShrinkerIntervalSeconds=60 jcs.default.cacheattributes.MaxSpoolPerRun=500 jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes jcs.default.elementattributes.IsEternal=false
In the System.out, I got:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- Cache Provider --> <bean id="cacheManager" class="org.springmodules.cache.provider.jcs.JcsManagerFactoryBean"> <!-- Optional properties --> <property name="configLocation" value="classpath:/jcs-config.properties" /> </bean> <bean id="cacheProviderFacade" class="org.springmodules.cache.provider.jcs.JcsFacade"> <property name="cacheManager" ref="cacheManager" /> </bean> <!-- 1.5+ Annotation --> <bean id="cachingAttributeSource" class="org.springmodules.cache.annotations.AnnotationCachingAttributeSource"></bean> <bean id="cachingInterceptor" class="org.springmodules.cache.interceptor.caching.MetadataCachingInterceptor"> <property name="cacheProviderFacade" ref="cacheProviderFacade" /> <property name="cachingAttributeSource" ref="cachingAttributeSource" /> <property name="cachingModels"> <props> <prop key="testCaching">cacheName=testCache</prop> </props> </property> </bean> <bean id="cachingAttributeSourceAdvisor" class="org.springmodules.cache.interceptor.caching.CachingAttributeSourceAdvisor"> <constructor-arg ref="cachingInterceptor" /> </bean> <bean id="flushingAttributeSource" class="org.springmodules.cache.annotations.AnnotationFlushingAttributeSource"></bean> <bean id="flushingInterceptor" class="org.springmodules.cache.interceptor.flush.MetadataFlushingInterceptor"> <property name="cacheProviderFacade" ref="cacheProviderFacade" /> <property name="flushingAttributeSource" ref="flushingAttributeSource" /> <property name="flushingModels"> <props> <prop key="testFlushing">cacheName=testCache</prop> </props> </property> </bean> <bean id="flushingAttributeSourceAdvisor" class="org.springmodules.cache.interceptor.flush.FlushingAttributeSourceAdvisor"> <constructor-arg ref="flushingInterceptor" /> </bean> <!-- Set up the objects to apply caching to --> <bean id="cacheableService" class="com.TigerCacheableService"> <property name="names"> <list> <value>Luke Skywalker</value> <value>Leia Organa</value> </list> </property> </bean> </beans>
But what was expected:Code:Processing getName Luke Skywalker Processing getName Luke Skywalker Processing getName Luke Skywalker
In the log I did not see any exception or errorCode:Processing getName Luke Skywalker Luke Skywalker Luke Skywalker
Can someone help me?
Thanks


