Using Worker to invalidate all objects under an URL
I never used Workers before. Let's say I have an external domain
example.com
. Can I use workers to cache some resources under this domain. Can I use workers to invalidate all resources under this domain?
Thanks2 Replies
Can I use workers to cache some resources under this domainSure, using the Cache API https://developers.cloudflare.com/workers/runtime-apis/cache/#put
Can I use workers to invalidate all resources under this domain?The Cache API is local colo/datacenter only, and only has Delete and not Purgge. To invalidate everything, you'd need to purge everything in the Cloudflare API, which you could call from a Worker https://developers.cloudflare.com/api/operations/zone-purge
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Cloudflare Docs
Cache · Cloudflare Workers docs
Control reading and writing from the Cloudflare global network cache.
Thank you