HTTP 缓存有哪些方案?

缓存(强缓存)
内容协商(弱缓存)

HTTP 1.1

Cache-Control: max-age=3600 Etag: ABC

If-None-Match: ABC 响应状态码:304 或 200

HTTP 1.0

Expires: Wed, 21 Oct 2015 02:30:00 GMT Last-Modified: Wed, 21 Oct 2015 01:00:00 GMT

If-Modified-Since: Wed, 21 Oct 2015 01:00:00 GMT 响应状态码:304 或 200

面试官可能还会提到 Pragma ,但 MDN 已经明确不推荐使用它。

更详细的内容可以看我的课程《全面攻克 Web 性能优化》中的《缓存与内容协商》视频。

Last updated