Which Cache Method to use at when? Which one take precedence?
So there are two way to custom CDN cache behavior. There is a way to cache using fetch API (https://developers.cloudflare.com/workers/examples/cache-using-fetch/), so this subrequest would become cachable.
There is also a Cache API (
caches.default
), and an example usage that looks like this https://developers.cloudflare.com/workers/examples/cache-api/. It is also used by some popular Cloudflare Workers framework (like hono
's hono/cache
https://hono.dev/docs/middleware/builtin/cache).
So my question is, which one should I use at when? If I do both, i.e. set cf.cacheTtl
when fetching a subrequest, where that subrequest route is actually cached by caches.default
. Now what happens?0 Replies