4.2.1. Calculating Freshness Lifetime
rfc 7234 4.2.1. Calculating Freshness Lifetime
freshness_lifetime计算
freshness_lifetime为下列第一个match的case中的值
o If the cache is shared and the s-maxage response directive
(Section 5.2.2.9) is present, use its value, or
o If the max-age response directive (Section 5.2.2.8) is present,
use its value, or
o If the Expires response header field (Section 5.3) is present, use
its value minus the value of the Date response header field, or
o Otherwise, no explicit expiration time is present in the response.
A heuristic freshness lifetime might be applicable; see
Section 4.2.2.
s-maxage
在shared cache中当作max-age使用
为什么max-age比Expires - Date优先级更高?
它俩表达相同的意思,都是origin server指定的,原本是想等的,但是在链路上Date可能被修改,这回导致Expires - Date失去精度。
invalid/stale
When there is more than one value present for a given directive
(e.g., two Expires header fields, multiple Cache-Control: max-age
directives), the directive's value is considered invalid. Caches are
encouraged to consider responses that have invalid freshness
information to be stale.