• I’m currently pulling data from an API which is limited to 10 requests per 10 seconds. I have a table which pulls information from 10 users and a plugin called W3 Cache stores that data.

    What if I have, lets say, 15 requests when I reload the page. Normally I get an error message from my requests because I went over the limit. Is there a way to cache what data it can, then slowly collect more data and fill in the table as every 10 seconds pass.

    When I use W3 Cache it just caches the error message along with 10 out of 15 of my user’s information.

Viewing 1 replies (of 1 total)
  • Yes, this can be done. You would use a technique called AJAX, this uses javascript in the client web browser, it would periodically send requests to your server, your server would agregate all the requests, serve what it could from cache, and forward the permitted 10 to the API. Your pages would be filled progressively rather than all at once on the initial load.

    Working with AJAX can be demanding, you would have to be comfortable working with javascript (esp dynamic DOM), PHP for the server side (with some SQL), and of course some HTML and CSS.

Viewing 1 replies (of 1 total)
  • The topic ‘How to cache API requests with a limit?’ is closed to new replies.