Jones
How to invalidate on-demand builder cache on netlify with nuxt/graphql
Hi everyone
I have the following situation: I have a CMS from which I use graphql to fetch data on a page basis to display it in a nuxt3 frontend.
Since netlify is now able to generate the page on the server with on-demand builders, we don't want to statically generate the site anymore.
Still we would like to have an effective caching in place. So far content is not cached at all, as it might change, if I understood correctly. This results in a function invocation for every page load, which is not desirable.
Instead I would like to cache all pages for a long time (or set a high TTL, as it is called for on-demand builders) and whenever an editor saves a page, I want to invalidate this pages cache/TTL, forcing a new on-demand build the next time somebody requests this page.
Now I do find some resources online about caching, durable caching etc. but because nuxt/netlify is doing this under the hood (I did not have to write any functions/builders myself) I have no idea how I could a granular caching with nuxt3 and netlify.
https://docs.netlify.com/configure-builds/on-demand-builders/#use-on-demand-builders
Thanks a lot and have a nice day.
10 replies