HTTP response header 中 Date 字段可以用来判断本地缓存是否失效吗?

2014-03-21 14:37:24 +08:00
 justfly
获取HTTP页面,body部分比较大有四五千行,我想做一个缓存,每次首先发一个Head请求,看 Response Header中的Date字段是否有更新,有更新再去拿get请求,不知道依赖Date靠不靠谱

HTTP/1.1这样描述:

The Date general-header field represents the date and time at which the message was originated

It SHOULD represent the best available approximation of the date and time of message generation, unless the implementation has no means of generating a reasonably accurate date and time

不知其中说的'生成'时间是否就是我理解的每次页面有改动的时间。

ps:我知道 etag和 if-modified-since 配合304 是可以完美做这件事情的,但是很多服务器没去实现,比如很多没有etag,很多加if-modified-since也永远返回200
4210 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/105277

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX