HTML:与 http-equiv=expires 和 http-equiv pragma=no-cache 指令相反

HTML: Opposite of http-equiv=expires and http-equiv pragma=no-cache directives

和你们中的许多人一样,多年来我一直在观察和使用这两个元标记,

<meta http-equiv="expires" content="now">
<meta http-equiv="pragma" content="no-cache">

除了它们用于确保浏览器加载新内容而不是缓存内容外,没有太多考虑它们的确切用途。

现在我遇到了一个客户,他认为通过相反的做法可以改善他网站糟糕的性能:强制网站加载缓存内容。也就是说,他确信当我们在 HTML 头部强制缓存时会好得多。

我只能访问前端资源。我四处搜索并没有找到与 "now""no-cache" 相反的值。所有关于如何关闭缓存的搜索只有 return 个结果。

当然,欢迎在 HTML 模板中实现此目的的任何其他想法:)

I searched around and haven't found what values would be the opposite of "now" and "no-cache".

  • "now"的反义词是“2147483648”
  • "no-cache"的反义词是"only-if-cached"

Note: The value 2147483648 is here for historical reasons, effectively represents infinity (over 68 years), and does not need to be stored in binary form; an implementation could produce it as a canned string if any overflow occurs, even if the calculations are performed with an arithmetic type incapable of directly representing that number. What matters here is that an overflow be detected and not treated as a negative value in later calculations.

参考资料