乐趣区

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.

响应头未配置缓存的情况

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

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

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

只配置 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.

有什么遗漏?

  • service work
退出移动版