Setting refresh-policies in Ehcache

Posted by Alex Ciminian on Stack Overflow See other posts from Stack Overflow or by Alex Ciminian
Published on 2010-05-10T09:10:52Z Indexed on 2010/05/10 9:14 UTC
Read the original article Hit count: 354

Filed under:
|
|
|

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 NeedsRefreshExceptions 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

© Stack Overflow or respective owner

Related posts about java

Related posts about ehcache