六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 66|回复: 0

Two Simple Rules for HTTP Caching

[复制链接]

升级  9.67%

67

主题

67

主题

67

主题

举人

Rank: 3Rank: 3

积分
229
 楼主| 发表于 2013-1-29 07:48:20 | 显示全部楼层 |阅读模式

  • Don’t cache HTML

    • Use Cache-Control: no-cache for dynamic HTML pages
    • Use the Last-Modified header with the current file time for static HTML

  • Cache everything else forever

    • For all other file types set an Expires header to the maximum future date your web server will allow

  • Modify URLs by appending a query string in your HTML to any page element you wish to ‘expire’ immediately.
 
     Two Simple Rules for HTTP Caching
 
     给静态内容设置cache的方法
 
 
 
     为了确保IE与Firefox的缓存行为一致,你应该:

  • 总是指定一个Expires头. 一般设置-1使用html页面能即时刷新或者对其它如图片,CSS,javascript脚本资源设置一个特定的过期时间
  • 如果你要强制页面刷新,甚至是点击后台按钮的时候,那就设置 Cache-Control: no-cache, no-store
  Firefox与IE浏览器缓存的两个重要区别
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表