ehcache的磁盘存储中的元素未过期 [英] ehcache not expiring elements from diskstore

查看:66
本文介绍了ehcache的磁盘存储中的元素未过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在磁盘存储区中缓存元素,而不要在内存/内存中缓存元素,为此我使用了以下配置,它将元素存储在磁盘上,但是5分钟后它不会过期/从磁盘中删除数据.

I want to cache elements only in the diskstore not in memory/ram, for this i have used following configuration, it stores the elements on disk but it doesn't expire/remove data from disk after 5 minutes.

<diskStore path="/global-cache" />

<cache name="globalCache" 
       maxElementsInMemory="0"
       eternal="true" 
       timeToIdleSeconds="0" 
       diskSpoolBufferSizeMB="1"
       diskPersistent="true"
       timeToLiveSeconds="300" 
       diskExpiryThreadIntervalSeconds="120"
       overflowToDisk="true"
       memoryStoreEvictionPolicy="LFU" />

我在ehcache配置中可以做什么,它将在指定时间后使磁盘存储中的元素过期?

What i can do in the ehcache configuration which will expire elements from diskstore after specified time?

推荐答案

您不能像

如果条目过期但未被访问,并且没有资源限制强行驱逐,则过期条目保留在原处.

If an entry expires but is not accessed, and no resource constraints force eviction, then the expired entry remains in place.

即使某些约束将强制驱逐,Ehcache也会仅删除过期条目的一部分,因此它不需要扫描所有磁盘存储.如果您绝对需要跟踪每个过期的条目,则必须自行实现此功能,但这会影响您的性能.可能就是这个功能未在Ehcache中内置的原因.

And even if some constraint would force eviction Ehcache might remove only part of expired entry, so that it would not need to scan all the disk store. If you absolutely need to keep track of every entry that's expired you'll have to implement this functionality your self, but that would hit your performance. Probably that's the reason this functionality isn't builtin in Ehcache.

这篇关于ehcache的磁盘存储中的元素未过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆