无缘无故快速清除页面

Fastly purges pages for no reason

我有一个将 Fastly 用作 FPC 的网站,我已阻止代码中的所有“清除”请求,以便在我需要时保留页面缓存。 “过期”header 有 +1 天的间隔。 为了测试我是否设置了一个 cronjob 以每分钟打开一个特定页面。 运行 1 天,所有请求都返回缓存结果,但是当我设置一个类似的 cronjob,间隔为 30 分钟时 - 请求变得不可缓存。 如果一段时间不请求,是否有setting/mechanism到flush/invalidate的缓存内容?或者这种行为的原因是什么?

缓存的内容有可能被逐出。

我建议通读 Fastly Developer Hub 页面“Cache freshness and TTLs”,其中指出:

IMPORTANT: We won't necessarily store objects for the full TTL requested, and may evict less popular objects earlier, especially if they are large. We also do not automatically evict objects when they reach their TTL. They simply become stale.

此外,Fastly 的“Serving stale content”指南指出:

Fastly has an LRU list, so objects are not necessarily guaranteed to stay in cache for the entirety of their TTL (time to live). But eviction is dependent on many factors, including the object's request frequency, its TTL, the POP from which it's being served. For instance, objects with a TTL of 3700s or longer get written to disk, whereas objects with shorter TTLs end up in transient, in-memory-only storage. We recommend setting your TTL to more than 3700s when possible.

快速阅读 Fastly 的“Caching configuration best practices”指南也是值得的,以防其中提到的任何内容您尚未配置。

如果失败,您还应该联系支持@fastly.com,因为他们是一支友好的团队,能够为您提供帮助。