基于http://geek.csdn.net/news/detail/131318
header的示例
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Type: image/png
Last-Modified: Tue, 08 Nov 2016 06:59:00 GMT
Accept-Ranges: bytes
Date: Thu, 10 Nov 2016 02:48:50 GMT
Content-Length: 3534
http缓存策略分为
1 缓存策略
Cache-Control 头里的 Public、Private、no-cache、max-age 、no-store
其中no-store为不存储,no-cache=0秒的max-age
2 缓存过期策略
如果没有缓存过期策略则根据响应头中2个时间字段 Date 和 Last-Modified 之间的时间差值,取其值的10%作为缓存时间周期
3 缓存对比策略
请求头如果带有 If-Modified-Since、If-None-Match则进行判断最后更新时间,返回缓存是否有效,所以即使是no-cache也可能被判断为有效而应用缓存,
整体流程为,根据本地过期策略判断是否已经过期,没有过期使用本地缓存,过期发送请求由服务器再次判断是否过期