Answer the question
In order to leave comments, you need to log in
How not to exceed the number of hits to a third-party resource from your domain?
Guys, hello!
I've never dealt with this kind of problem before, so first things first...
The goal is for my site to request media resources from another api (or even a site), which, as expected, has a limited number of requests per a certain period of time to balance the load.
For my part, I see the problem in such a way that as soon as, conditionally, ~ 10 users make requests from my site at the same time, the api of another domain will simply return http code 429, and I would like to avoid this. Please tell me a solution or a vector where to dig ((I know about caching only in theory. Perhaps it is connected with this case, that's why the tag was added))
Answer the question
In order to leave comments, you need to log in
Such is the circle: before requesting api info, open the file and see when the request was made, if less than, for example, 10 minutes ago, then give the cache ... if more, then ask for api info, process it, save it in cache, write down the request time to the file.
More or less like this…
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question