Cache function in advanced mode

Is there any way to cache the result of a function invocation in the advanced mode depending on the URL?

You can cache a result (Cache · Cloudflare Workers docs) but not put a cache in front of a Function.

1 Like

Thanks for the reply. But what would happen if you add a custom domain to the Pages app that has a Cache Rule to cache everything?

Same thing. Functions/Workers will always fire, they sit before cache in the request chain.

This is an intentional choice, caching those responses could be very bad.

1 Like

Okay thanks for the clear answer. So there is no real way to implement an Incremental Static Regeneration solution where the generated page would be returned directly without running the worker? For example with Netlify you can set a ttl to achive this (https://docs.netlify.com/configure-builds/on-demand-builders/).

does this also work for cache fetch like in workers?