I have build an API with Cloudflare Pages Functions to get data from Faunadb. it’s cool that Cloudflare Pages Functions has file based routing, middlewares system & more …
I have added a top-level middleware to set CORS Headers & Cache Responses using Cloudflare Workers Cache API & it’s working fine, but purging the cache is not something that I am be able to do, because there’s no ways to purge the Cloudflare Cache in a Free Account.
Are there any methods that I can use to purge the Cache. Thanks.
What do you mean? If you are using a custom domain you should be able to clear the cache of that zone (though I have not tested this with Pages Functions ) - are you perhaps trying to clear the cache of a pages.dev zone? Because I believe that is not possible from the dashboard.
You could call caches.delete to remove a specific request from cache, but not purge it all unless on a custom domain zone.
to be clear, I’m not using a custom domain, it’s just in default pages.dev domain.
So I should have to Setup a route to clear the cache based the cache key. Great, I will try it.