Is it possible to use cache API(caches.default.match()|put(), etc) with worker inside CF-application. I’ve tried to do it and wrapped caching method inside event.waitUntil().
Caching method looks like:
caches.default.put(request, response).then((result) => {
fetch(‘my-local-ngrok-link’);
});
I know that result is undefined but in any case request should be sent.
But there is no requests to my ngrok.
Are you testing this in playground?
The Service Workers Cache API is currently unimplemented in the Cloudflare Workers Preview. Cache API operations which would function normally in production will not throw any errors, but will have no effect. Notably, Cache.match() will always return undefined, and Cache.delete() will always return false. When you deploy your script to production, its caching behavior will function as expected.
1 Like