科帮网-Java论坛、Java社区、JavaWeb毕业设计

登录/注册
您现在的位置:论坛 资料库 JAVA开发 > Ehcache timeToIdleSeconds和 timeToLiveSeconds区别
总共48086条微博

动态微博

查看: 1810|回复: 0

Ehcache timeToIdleSeconds和 timeToLiveSeconds区别

[复制链接]
admin    

1244

主题

544

听众

1万

金钱

管理员

  • TA的每日心情

    2021-2-2 11:21
  • 签到天数: 36 天

    [LV.5]常住居民I

    管理员

    跳转到指定楼层
    楼主
    发表于 2016-08-23 10:58:05 |只看该作者 |倒序浏览
    一直不理解ehcache中 timeToIdleSeconds和 timeToLiveSeconds 这两个配置的区别,特意找到官方文档看了一下,基本理解了它的意思。
    首先看一段原文:

    What is the difference between TTL, TTI, and eternal?
    These are three cache attributes that can be used to build an effective eviction configuration.
    It is advised totest and tune these values to help optimize cache performance.
    TTI timeToIdleSeconds is the maximumnumber of seconds that an element can exist in the cache without being accessed,
    while TTL timeToLiveSeconds is the maximum number of seconds that an element can exist in the cache whether or not is has been accessed.
    If the eternal flag is set, elements are allowed to exist in the cache eternallyand none are evicted.
    The eternal setting overrides any TTI or TTL settings. These attributes are set for the entire cache in the configuration file. If you want to set them per element, you must do it programmatically


    主要意思:

    1.TTI timeToIdleSeconds is the maximum number of seconds that an element can exist in the cache without being accessed:
    TTI用于设置对象在cache中的最大闲置时间,就是 在一直不访问这个对象的前提下,这个对象可以在cache中的存活时间。
    2.TTL timeToLiveSeconds is the maximum number of seconds that an element can exist in the cache whether
    or not is has been accessed.
    TTL用于设置对象在cache中的最大存活时间,就是 无论对象访问或是不访问(闲置),这个对象在cache中的存活时间。
    3.If the eternal flag is set, elements are allowed to exist in the cache eternally and none are evicted。
    当配置了 eternal ,那么TTI和TTL这两个配置将被覆盖,对象会永恒存在cache中,永远不会过期。


    科帮网-Java论坛、Java社区、JavaWeb毕业设计 1、本主题所有言论和图片纯属会员个人意见,与本社区立场无关
    2、本站所有主题由该帖子作者发表,该帖子作者与科帮网-Java论坛、Java社区、JavaWeb毕业设计享有帖子相关版权
    3、其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和科帮网-Java论坛、Java社区、JavaWeb毕业设计的同意
    4、帖子作者须承担一切因本文发表而直接或间接导致的民事或刑事法律责任
    5、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
    6、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
    7、科帮网-Java论坛、Java社区、JavaWeb毕业设计管理员和版主有权不事先通知发贴者而删除本文


    JAVA爱好者①群:JAVA爱好者① JAVA爱好者②群:JAVA爱好者② JAVA爱好者③ : JAVA爱好者③

    快速回复
    您需要登录后才可以回帖 登录 | 立即注册

       

    发布主题 快速回复 返回列表 联系我们 官方QQ群 科帮网手机客户端
    快速回复 返回顶部 返回列表