Is there a pattern that would allow me to clear a cache item for every worker in the CDN?
I would like to clear the worker cache for every location. My workflow is that someone will make an update to some particular item in the cache, and I need to be able to evict it.
If I absolutely had to hack this together I would write handler that clears the cache for a given item, then make a request to clear the cache from a bunch of different locations. Hoping there are some better options here.
5 Replies
Will normal cache purge purge everything?
Cloudflare Docs
Purge by single-file · Cloudflare Cache (CDN) docs
With purge by single-file, cached resources are immediately removed from the stored assets in your Content Delivery Network (CDN) across all data …
A single-file purge performed through your Cloudflare dashboard does not clear objects that contain any of the following: - Custom cache keysWasn't sure if something like counts as a custom cache key
Cloudflare Docs
How the Cache works · Cloudflare Workers docs
How Workers interacts with the Cloudflare cache.
FWIW figured this out
Call cache.delete within a Worker to invalidate the cache for the asset with a matching request variable. Assets purged in this way are only purged locally to the data center the Worker runtime was executed.https://discord.com/channels/595317990191398933/779390076219686943/1049616969751609394 Ugh Or maybe you're right? I'm very confused