I’m trying to understand how cache gets expired at the edge.
GitHub - cloudflare/worker-sites-template (which uses
getAssetFromKVfrom GitHub - cloudflare/kv-asset-handler: Routes requests to KV assets which supposedly has a 2 day TTL)
- a custom domain (so the cache is enabled)
- Workers Paid plan
wrangler publish, refresh the page on my custom domain, and see the
cf-cache-status HTTP header in the response for index.html as MISS. I refresh the page, and see HIT. This of course makes sense. If I refresh again, I get another HIT for index.html… this also makes sense.
However, if I wait a random amount of time, say ~5 minutes, refresh the page,
cf-cache-status for index.html is sometimes MISS (often along with a different value for cf-ray). But, the static assets in “worker-sites-template”, e.g.
/img/200-wrangler-ferris.gif will have a
cf-cache-status of HIT.
So my hypotheses is that a different worker served the request for index.html but didn’t have it cached, hence the MISS. But why did the gif file have a cache HIT? Does some stuff fall out of the edge cache and other stuff does not? How does the logic work? Is it some kind of LRU per datacenter, or per worker?