I’m trying to get EHCache to mark cache elements as expired if they have not been accessed in a particular way, within a specified amount of time.
I have an automated cache-refresher which should refresh elements in the cache without updating the last-accessed time. It runs on a regular schedule. However, if a user requests something from the cache through the application, then the last-accessed time should be updated. Elements should expire and be removed from the cache after a week of user inactivity.
Does EHCache have anything already in-place that would solve this sort of problem? I see the putQuiet and getQuiet methods, but I don’t see any explicit mention of them not updating the last-accessed time. Also, is there any real difference between the timeToLiveSeconds and timeToIdleSeconds parameters?
Thanks,
Mike
for other attributes refer the ehcache.xml that ships with the ehcache package. you can instantiate your cache with the Cache construtor with the parameters then the cache will manage this on its own