缓存策略交互 — 最长使用期限和最长过期时间
来源:互联网 发布:正则表达式 手机号js码 编辑:程序博客网 时间:2024/06/05 17:00
To help ensure that the freshest content is returned to the client application, the interaction of client cache policy and server revalidation requirements always results in the most conservative cache policy. All the examples in this topic illustrate the cache policy for a resource that is cached on January 1 and expires on January 4.
In the following examples, the maximum staleness value (maxStale) is used in conjunction with a maximum age (maxAge):
If the cache policy sets maxAge = 5 days and does not specify a maxStale value, according to the maxAge value, the content is usable until January 6. However, according to the server’s revalidation requirements, the content expires on January 4. Because the content expiration date is more conservative (sooner), it takes precedence over the maxAge policy. Therefore, the content expires on January 4 and must be revalidated even though its maximum age has not been reached.
If the cache policy sets maxAge = 5 days and maxStale = 3 days, according to the maxAge value, the content is usable until January 6. According to the maxStale value, the content is usable until January 7. Therefore, the content gets revalidated on January 6.
If the cache policy sets maxAge = 5 days and maxStale = 1 day, according to the maxAge value, the content is usable until January 6. According to the maxStale value, the content is usable until January 5. Therefore, the content gets revalidated on January 5.
When the maximum age is less than the content expiration date, the more conservative caching behavior always prevails and the maximum staleness value has no effect. The following examples illustrate the effect of setting a maximum staleness (maxStale) value when the maximum age (maxAge) is reached before the content expires:
If the cache policy sets maxAge = 1 day and does not specify a value for maxStale value, the content is revalidated on January 2 even though it has not expired.
If the cache policy sets maxAge = 1 day and maxStale = 3 days, the content is revalidated on January 2 to enforce the more conservative policy setting.
If the cache policy sets maxAge = 1 day and maxStale = 1 day, the content is revalidated on January 2.
为了确保新的内容返回到客户端应用程序,在最保守的客户端缓存策略和服务器重新验证要求总是相互作用的结果。本主题中的所有示例说明是基于1月1日缓存,并于1月4日到期的资源的缓存策略。
在下面的例子中,最大的过期值(maxstale)采用的是与最大年龄结合(MAXAGE):
如果缓存策略集MAXAGE = 5天不指定maxstale值,根据MAXAGE价值,内容可用到1月6日。然而,根据服务器的验证要求,内容在1月4日到期。因为内容截止日期比较保守(早),它将优先于MAXAGE政策。因此,该内容在1月4日到期,必须重新验证即使其最大年龄尚未达到。
如果缓存策略集MAXAGE = 5天,maxstale = 3天,根据MAXAGE价值,内容可用到1月6日。根据maxstale价值,内容可用到1月7日。因此,内容在1月6日被重新验证。
如果缓存策略集MAXAGE = 5天,maxstale = 1天,根据MAXAGE价值,内容可用到1月6日。根据maxstale价值,内容可用到1月5日。因此,内容在1月5日被重新验证。
当最大年龄小于内容到期日期,更保守的缓存行为被执行和最大失效期的值没有影响。下面的例子说明设置最大失效期的影响(maxstale)值时的最大年龄(MAXAGE)是内容到期之前达成:
如果缓存策略集MAXAGE = 1天不指定maxstale值,内容是在1月2日被重新验证,即使它没有过期。
如果缓存策略集MAXAGE = 1天,maxstale = 3天,内容是在1月2日执行更为保守的策略设置。
如果缓存策略集MAXAGE = 1天,maxstale = 1天,内容是在1月2日执行更为保守的策略设置。
- 缓存策略交互 — 最长使用期限和最长过期时间
- 缓存策略交互 — 最长使用期限和最低新鲜度
- 最长时间
- redis过期时间和删除策略
- 使用Retrofit和Okhttp实现网络缓存。无网读缓存,有网根据过期时间重新请求
- 使用Retrofit和Okhttp实现网络缓存。无网读缓存,有网根据过期时间重新请求
- 缓存过期时间
- ttserver 缓存使用和过期设置
- redis过期时间的过期策略
- 最长
- WEB缓存_缓存过期策略
- USACO s1.2.Milking Cows(求最长连续时间和最长间断时间)
- 关于redis缓存时间过期处理 ----在项目中的使用
- Redis和DelayQueue设计具有过期时间的缓存
- nginx设置静态页面压缩缓存和过期时间
- 缓存过期时间那些事儿
- 动态规划入门策略—“最长公共子序列”
- Eacache缓存+缓存的过期时间
- Json序列化及反序列化(备忘)
- js判断数据类型
- Spring Cloud Sleuth 教程
- 缺少log4j包或包版本冲突报错
- 大型网站架构系列:缓存在分布式系统中的应用(三)
- 缓存策略交互 — 最长使用期限和最长过期时间
- 【数据库-MySql】函数
- 索引查询
- SpringMVC的拦截器(Interceptor)和过滤器(Filter)详解
- hadoop入门级总结二:Map/Reduce
- Qt动画框架-(3)分组动画
- よくある例外型
- 31个Android 开发者工具
- Makefile教程