上ehache的文档说:如何生存时间和时间之间的区别在了Ehcache闲置
timeToIdleSeconds: Sets the time to idle for an element before it expires.
i.e. The maximum amount of time between accesses before an element expires
timeToLiveSeconds: Sets the time to live for an element before it expires.
i.e. The maximum time between creation time and when an element expires.
我明白timeToIdleSeconds
但是否就意味着创建&第一次访问后缓存项目,timeToLiveSeconds不适用了?
因此,我认为我们总是希望设置闲置时间
2010-04-21 03:41:58
在上面的注释中,当您说“让我们说timeToIdleSeconds = 3.如果对象在4秒内未被请求,则对象将失效”。说无效 - 这是什么意思?它是否将其从堆中删除? 如果从缓存中删除对象,那么我对使用timeToLive参数有什么困惑。 当我们做了POC时,我们看到数据是在时间之后从撷取到闰秒。虽然timetoLive的值更高,但我预料它会从缓存中获取,因为timetoLive的值比timeToIdle高得多。 – Gayathri 2011-01-30 16:45:53
@Gayathri如果你有一个经常访问的数据项(每两秒),但TTL为60秒。即使连续访问(从不闲置),它仍会每六十秒从源头中取出一次。 – 2013-03-01 14:38:30