0

relatively new to databases here (and dba).

I've been recently looking into Riot Games' APIs, however now realising that you're limited to 10 calls per 10 seconds, I need to change my front-end code that was originally just loading all the information with lots of and lots of API calls into something that uses a MySQL database.

I would like to collect ranked data about each player and list them (30+ players) in an ordered list of ranking. I was thinking, as mentioned in their Rate Limiting Page, "caching" data when GET-ing it, and then when needing that information again, check if it is still relevant - if so use it, if not re-GET it.

Is the idea of adding a time of 30 minutes (the rough length of a game) in the future to a column in a table, and when calling check whether server time is ahead of the saved time. Is this the right approach/idea of caching - If not, what is the best practice of doing so?

Either way, this doesn't solve the problem of loading 30+ values for the first time, when no previous calls have been made to cache.

Any advice would be welcome, even advice telling me I'm doing completely the wrong thing!

If there is more information needed I can edit it in, let me know.

tl;dr What's best practice to get around Rate-Limiting?

Olly
  • 360
  • 3
  • 20
  • 2
    I think this is a good question, but I feel like this would be a better topic for http://programmers.stackexchange.com/ since it's about a general programming problem (rate-limiting and caching) and not a specific problem with your code. – Jason P Sep 28 '15 at 14:28
  • Ah ok, I'll leave it up for a bit longer and if it does not get anywhere then i'll delete and move over if that's best - Thanks – Olly Sep 28 '15 at 14:30

1 Answers1

2

Generally yes, most of the large applications simply put guesstimate rate limits, or manual cache (check DB for recent call, then go to API if its an old call).

When you use large sites like op.gg or lolKing for Summoner look ups, they all give you a "Must wait X minutes before doing another DB check/Call", I also do this. So yes, giving an estimated number (like a game length) to handle your rate limit is definitely a common practice that I have observed within the Riot Developer community. Some people do go all out and implement actual caching though with actual caching layers/frameworks, but you don't need to do that with smaller applications.

I recommend building up your app's main functionality first, submit it, and get it approved for a higher rate limit as well. :)

Also you mentioned adjusting your front-end code for calls, make sure your API calls are in server-side code for security concerns.

Austin
  • 3,010
  • 23
  • 62
  • 97