I’m using Netlify functions to pull products, and collections, from Shopify. Everything works great, and is actually faster than Azure functions which I was using before!
What I’d like to do is cache the JSON response. So in my code frontend I would make a JSON request to mysite.com/data/<product-id>.json, and if that’s a 404 it will call the Netlify functions.
When the function is called I would like to cache the response and store it in mysite.com/data/<product-id>.json.
If you decide to do this during runtime (when your site is being used), you’d have to trigger an entirely new deploy as you cannot add a single file to Netlify.
If you’re hosting your frontend elsewhere, you could have a chance to look at their API and features to see if that’s possible.
Finally, if you want to do this, you would have to do this during build time. Generate the JSON files as needed and publish them along with the deploy.