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
相關文章
相關標籤/搜索