How do I set an cache time for objects in OSCache using spring-modules?

How do I set an cache time for objects in OSCache using spring-modules?

I have an application in need of some caching, and for some of the semi-static data, I want them to stay in the cache a maximum amount of time (for instance 10 minutes) before being refreshed. My system merely retrieves data, never updates it, so I have no idea of when to flush the cache using the property. In the OSCache docs, such an expiry time can be set both using the programmatic API and the configuration for the taglib, but the spring-modules documentation is silent on the matter.

Does anyone know if/how this can be done?

converting J2EE App from Sql to Oracle - suggestions with effecient approach


System properties can't be resolved in Spring XML using Maven
take a look at
Spring - How 'multiple' AOP behaviors to sevices are resolved?

Spring: Getting FactoryBean object instead of FactoryBean.getObject()
Caching Models they provide an example with org.springmodules.cache.provider.jcs.JcsCachingModel.
Spring, iBatis, MySQL - how to manage transactions?
try playing around with org.springmodules.cache.provider.oscache.OsCacheCachingModel.
Is there any Spring-Security-based production-ready security package for Java?
the source code from gives me the properties.
autocomplete text box
private String cronExpression;.
What is the difference between putting @Autowired to a variable and a method?
private String[] groups;. private Integer refreshPeriod;. so you need to set the "refreshPeriod" property.


I figured it out.

The answer is hidden in ehcache's own configuration file.

By setting the property "timeToLiveSeconds" to for instance "600", the element in the cache will expire after ten minutes.


76 out of 100 based on 46 user ratings 1246 reviews