V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
justfly
V2EX  ›  问与答

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

  •  
  •   justfly · 2014-03-21 14:37:24 +08:00 · 4190 次点击
    这是一个创建于 3660 天前的主题,其中的信息可能已经有所发展或是发生改变。
    获取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
    第 1 条附言  ·  2014-03-21 15:40:46 +08:00
    Date是访问页面的时候的服务器时间,基本没啥用。。。。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3661 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 05:02 · PVG 13:02 · LAX 22:02 · JFK 01:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.