Caching in HTTP 笔记

文章

Caching in HTTP

HTTP 缓存的做用

HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches.

响应头未配置缓存的状况

如下状况,浏览器不会对请求进行缓存html

没有配置 cache-control 或 last-modified、expiressegmentfault

image.png

只配置了 cache-control,且值为 public 或 privatepromise

image.png

只配置 last-modified 的状况

  • 未配置 expires
  • cache-control浏览器

    • 未配置
    • 或配置,值为 public 或 private

将采用 Heuristic Expiration缓存

Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms that use other header values (such as the Last-Modified time) to estimate a plausible expiration time. The HTTP/1.1 specification does not provide specific algorithms, but does impose worst-case constraints on their results. Since heuristic expiration times might compromise semantic transparency, they ought to used cautiously, and we encourage origin servers to provide explicit expiration times as much as possible.

其余状况

网上有不少介绍ide

经过HTML的META设置expires和cache-control 控制缓存真的能生效吗?

这是IE的私有属性spa

有什么遗漏?

  • service work