jav*_*irl 5 caching terracotta ehcache
在我的ehcache配置中,我看到了这些:
eternal="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
Run Code Online (Sandbox Code Playgroud)
这有什么意义?
文档提到timeToLiveSeconds ="0"表示不会进行这些检查.所以这意味着物体将是永恒的,即使"永恒"被设定为假?
min*_*das 10
如果你看一下CacheConfiguration.java:826(我的Ehcache版本是2.6.5),你会看到以下内容:
if (eternal) {
setTimeToIdleSeconds(0);
setTimeToLiveSeconds(0);
}
Run Code Online (Sandbox Code Playgroud)
所以它基本上是一回事.
小智 5
设置为true时,属性'eternal'将覆盖TimeToIdle和TimeToLive参数.设置为false时,它不会影响配置.因此,在上述情况下,将考虑setTimeToIdleSeconds(0)和setTimeToLiveSeconds(0)参数,并且缓存元素将保持生命周期(因为0表示无限).