3 ms·
I like caches with a short TTL. Even caching for a single second will cap the amount of API requests. Just setting an expiry a minute out when you generate the
by vidarh 2y ago
I like caches with a short TTL. Even caching for a single second will cap the amount of API requests. Just setting an expiry a minute out when you generate the page and put it behind a decent caching reverse proxy, is a decent option. Or just write the API response to a file and stat that file to check age before you respond (if so, just make sure to avoid race conditions; e.g. write to a separate file and rename). If you have something like Redis running, that's of course a great option too.
(but just having users click a button is likely to be more than enough)
- beej71 2y agoThis is true, and it would be super simple to write a quick PHP caching script.