Hi,
i am using spring annotation based caching, the cache is created but on subsequent request to same method the values are not cached. can you suggest what can be the problem
---------------------------------------------
//StatesDAO class
@Cacheable(cacheName="stateCache")
public List findAllStates() throws DAOException {
//some code that returns a list of states.
return list;
}
------------------------------------------
//ehcache.xml
I'm getting the same issue. I have my Spring Annotations and EhCache set up but the chaching doesn't seem to be in effect (it's no faster... even with a forced delay of three seconds!!).
I've spent sometime looking into this.
It seems, depending on how you get access to your bean with cached methods, you might or not get results cached.
I've created a small test app that failed as well. It first only had the SimpleAppTest. I then looked into how the ehcache annotation project had its tests written and created the AutowiredAppTest, which passes for some reason.
I've submitted that to the ehcache-annotation guys for a more in depth explanation here. In the meantime, I hope that example helps...