文章

Caching in HTTP

HTTP 缓存的作用

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

响应头未配置缓存的情况

以下情况,浏览器不会对请求进行缓存

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

image.png

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

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.

其他情况

网上有很多介绍

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

这是IE的私有属性

有什么遗漏?

  • service work

其他资料


siwuxie
528 声望67 粉丝

404