前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ehcache timeToIdleSeconds和 timeToLiveSeconds区别

Ehcache timeToIdleSeconds和 timeToLiveSeconds区别

作者头像
小柒2012
发布2018-04-13 16:07:31
2K0
发布2018-04-13 16:07:31
举报
文章被收录于专栏:IT笔记IT笔记

一直不理解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中,永远不会过期。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-08-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档