JingchaoZhao / js-learning

knowledge of webs
0 stars 0 forks source link

tips: 缓存 #15

Open JingchaoZhao opened 5 years ago

JingchaoZhao commented 5 years ago
  1. 强缓存 200 (from cache)
  2. 协商缓存 304 (not modified)
JingchaoZhao commented 5 years ago

强缓存 header

  1. expires
  2. cache-control: max-age=Number no-cache: 不使用本地缓存。需要使用协商缓存; no-store: 禁止使用浏览器缓存数据; public: 可以被所有用户缓存 private: 只能被终端用户的浏览器缓存

cache-control > expires

JingchaoZhao commented 5 years ago

协商缓存:

  1. Last-Modified/If-Modified-Since
  2. Etag/If-None-Match

先判断Etag 再判断Last-Modified