Is there any to specify a data refresh policy in Ehcache? I am currently migrating an application from OSCache to Ehcache and I can't seem to find any way to specify when an element needs refreshing, besides setting timeToIdle
and timeToLive
.
What I want is: on accessing an element from the cache, check with it's associated resource to see if it was updated later than the lastUpdateTime
of the cache element. If yes, refresh the cache; else serve the content from the cache.
In OSCache this was done by catching NeedsRefreshException
s and setting custom refresh policies for the elements. I've been digging around in the docs for a while now, but I wasn't able to find any methods or examples of how I could accomplish this in Ehcache.
Any help would be appreciated :).
Alex