I am using Spring and ehcache. using a query I populate the data into the Cache, this process has to happen every 10 mins. Is there a configuration to set this??
Thanks in Advance
I am using Spring and ehcache. using a query I populate the data into the Cache, this process has to happen every 10 mins. Is there a configuration to set this??
Thanks in Advance
Typically, ehCache would be used to give a ttl to invalidate your cache automatically. From what I can gather from your question, you are asking to automatically refresh the cache every ten minutes. For that, I would run a scheduled service that evicts and reloads. For example:
@Cachable("Foo")
public Foo getFoo() {
...
}
@CacheEvict("Foo")
public void evictFoo(){
...
}
@Scheduled(fixedRate = 10L * 60L * 1000L) //Ten minutes
public void automaticCacheRefresh(){
evictFoo();
getFoo();
}