

























功能:根据Yslow原则,缓存合适使用,可以大大提高速度。
使用Http头:
Cache-Control 用于控制HTTP缓存
Expires 表示存在时间
设置格式如下:
<meta http-equiv="Cache-Control"
content="max-age=7200" />
<meta http-equiv="Expires" content="Mon, 20 Jul 2009
23:00:00 GMT" />
在servlet中设置:
response.setContentType("application/octet-stream");response.setHeader("Cache-Control","max-age=300");
setDateHeader
setIntHeadr
现象1:在Firefox下,刷新的时候,对于非静态地址,都会重新加载,返回200,静态内容返回304,是检测是否更新的。而在地址栏中回车,以及后退的时候,对于缓存的内容不会重新加载。IE下未测试。
-----------------------------
http://www.w3.org/Protocols/
http://www.ietf.org/internet-drafts/draft-ietf-httpbis-p6-cache-06.txt

此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。