使 EHCache 使未以特定方式访问过的元素过期
我试图让 EHCache 将缓存元素标记为过期(如果在指定时间内未以特定方式访问它们)。
我有一个自动缓存刷新器,它应该刷新缓存中的元素而不更新上次访问时间。它按正常时间表运行。但是,如果用户通过应用程序从缓存中请求某些内容,则应更新上次访问时间。用户不活动一周后,元素应该过期并从缓存中删除。
EHCache 是否已经有任何可以解决此类问题的东西?我看到 putQuiet 和 getQuiet 方法,但我没有看到任何明确提及它们不更新上次访问时间的信息。另外, timeToLiveSeconds 和timeToIdleSeconds 参数?
谢谢, 麦克风
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于其他属性,请参阅 ehcache 包附带的 ehcache.xml。您可以使用 缓存构造函数 以及参数,然后缓存将自行管理
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