Well, it builds and runs fine, but it doesn't appear that caching is working. In my case, I'm caching the return of a SOAP call, however, in my logs I can see that the SOAP request is being executed instead of returning a cached response.
My caching app context is:
Code:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ehcache="http://www.springmodules.org/schema/ehcache"
xsi:schemaLocation="
http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springmodules.org/schema/ehcache classpath:springmodules-ehcache.xsd
http://www.springmodules.org/schema/cache classpath:springmodules-cache.xsd">
<!-- Cache manager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml" />
</bean>
<!-- Cache provider -->
<bean id="cacheProvider" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
<property name="cacheManager" ref="cacheManager" />
</bean>
<!-- Cache regions for annotated cache -->
<ehcache:annotations>
<ehcache:caching id="productPageCacheModel" cacheName="PRODUCT_PAGE_CACHE" />
<ehcache:flushing id="productPageFlushModel" cacheNames="PRODUCT_PAGE_CACHE" when="after" />
</ehcache:annotations>
</beans>
ehcache.xml is:
Code:
<ehcache>
<diskStore path="java.io.tmpdir/CIT_CACHE"/>
<cache name="PRODUCT_PAGE_CACHE"
maxElementsInMemory="300"
eternal="false"
timeToIdleSeconds="500"
timeToLiveSeconds="500"
overflowToDisk="true"
maxElementsOnDisk="1000"
diskPersistent="true"/>
<defaultCache maxElementsInMemory="100"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk="1000"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
And my classes have caching annotations as such:
Code:
...
@Cacheable(modelId = "productPageCacheModel")
private Map getCatalogPage(int siteId, int page, int folderId, int resultsPerPage){
...
So my "modelId" matches the "id" in my caching application context, and the application context's "cacheName" matches the "name" attribute in my ehcache.xml.
Logging from Spring-Modules and ehCache is empty. And just to make sure, we don't need to have a "Cacheable" interface implemented on the class, right?
Any ideas?