Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does ehCache have any option of auto refreshing?

Tags:

spring

ehcache

Does ehCache have any feature of auto refreshing? If yes, please let me know how to do that. If not, please let me know few possible and efficient ways in which ehCache refresh can be done.

like image 835
Saravana6788 Avatar asked Jun 19 '14 09:06

Saravana6788


2 Answers

There is no way for EhCache to know how the data that was inserted into to it, was produced. That part is totally application specific. There fore EhCache cannot refresh itself automatically- it can't pull the data, the data has to be pushed into it.

In order to do that you need to add another component to your application that will run at a scheduled time and while insert the appropriate data into EhCache.

Spring has awesome support for scheduled tasks. Check out this part of the documentation

like image 189
geoand Avatar answered Nov 20 '22 18:11

geoand


ehCache has builtin eviction algorithms that you can use by setting timeToIdleSeconds and timetoLiveSeconds this will tell ehcache when to eject that data from the cache and force a reload of the data from your persistence data source. Read the following ehCache document on more detailed instruction on configuring TTL http://ehcache.org/documentation/configuration/data-life

like image 3
ebell Avatar answered Nov 20 '22 20:11

ebell