最大年龄和304未修改处理 [英] Max-age and 304 Not Modified Processing

查看:128
本文介绍了最大年龄和304未修改处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在看标准 - 但不完全确定以下内容:

I've been looking at the standards - but was not entirely sure about the following:

如果我们有一个变体(资源,图像,页面等),服务的缓存设置为max-age = 259200(3天),服务器也在处理ETag和上次修改日期 - 那么当达到max-age时会发生什么 - 但是资源还没有被修改?

If we have a variant (resource, image, page etc) that is served with a cache setting of max-age=259200 (3 days) and the server is also processing ETags and last modified dates - then what will happen when the max-age is reached - but the resource has not been modified?

我希望将会发生的是,3天后 - 客户端将再次请求资源 - 如果没有更改,将收到304 Not Modified响应。如果缓存控制响应(在304响应期间)仍然包含max-age = 259200 - 那么我希望客户端将继续使用其本地缓存副本,而不是再请求另外3天。

What I'm hoping will happen is that after 3 days - the client will request the resource again - and if it has not changed will received a 304 Not Modified response. If the cache control response (during the 304 response) also still contains max-age=259200 - then I'm hoping the client will continue to use its local cached copy and not request again for another 3 days.

我担心的是,一旦达到最大年龄 - 客户端将不再缓存资源 - 每次加载资源时都会发出新的请求 - 然后是304如果资源尚未修改,则为Not Modified响应。即我们现在每次使用都会收到http请求,而不是再使用本地缓存3天。

What I'm afraid will happen is that once the max-age is reached - the client will no longer cache the resource - making a fresh request each time the resource is loaded - followed by a 304 Not Modified response if the resource has not been modified. i.e. we're now getting http requests for every use as opposed to using the local cache for another 3 days.

想法?

推荐答案

它将再缓存3天。 RFC 2616 10.3.5


如果缓存使用收到的304响应来更新缓存条目,缓存必须更新条目以反映在条目中给出的任何新字段值回复

有关年龄计算的详细信息

这篇关于最大年龄和304未修改处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆