Caching to save on request quota

Hi, We are developing an API powered by Pages and Functions. We get many requests with the same parameter which get the same response every time (but they can't be served statically). Is it possible to cache the response based on the url and params to save on requests quota?
3 Replies
neociber
neociber15mo ago
It's not a complete solution, but what about just using cache-control ?
Samantas5855
Samantas5855OP15mo ago
From what I understand this is for browsers. We are developing an app, each app user will only perform one request in a timeframe, but since the app has multiple users that amounts to multiple requests. Since some of these requests have the same parameters and receive the same response it would be smart and efficient if we could utilize some form of cache to save on the requests quota.
zegevlier
zegevlier15mo ago
Workers (and thereby functions) run before cache, so you cannot cache their responses to reduce worker invocations. You can use the cache API to cache the response from inside the worker, but this still counts as an invocation.
Want results from more Discord servers?
Add your server