I'm looking for a solution to reduce server load on my API. I thought it's a good idea to cache the content for 1 second, so the server will get only 1 requests each second instead of many. However, I wasn't able to make it work:
In
Use origin settings based on Cache-Control headers
mode: the Google CDN ignores the'Cache-Control', 'public, max_age=1'
header. It looks like I can't cache JSON in this mode, probably because of the missingContent-Range
orTransfer-Encoding: chunked
header?In
Force cache all content
mode: it actually works, but the minimum TTL is 1 minute, which is just too much for me. I'd like to update the content every second.
I'm quite surprised no one uses short-lived caches for API-s, since it can theoretically reduce load and maybe save costs when using with external APIs (eg. you don't need to pay twice if you request the same thing from an expensive API endpoint). Any ideas?