JavaScript API Call Caching

I am requesting the GitHub API from the client using JavaScript ( on this page ).

Each time a page loads, there are 14 API calls, which means that I will end up very quickly removing the GitHub API data rate limit of 5,000 calls per hour.

Most of the caching strategies I've seen suggest that you have access to the server, but in my case I run a purely static Middleman site.

So my question is this: how can I cache API requests from a client? Are there any third-party applications that provide this service?

(Note that my use case is for different clients accessing the page (for example, it was associated with Hacker News ), and not with one client, which local caching does not really help.)

+4
source share
3 answers

Firebase @David, , , . , Middleman, Github api, , Firebase, , , . .

Web sequence diagram for checking Firebase and using Github API

+8

cookie. , , , , API. , .

, ~ 357 .

, . ( 5 ). , 5 . , . , API. , , 5 , ~ 30 .

http://diveintohtml5.info/storage.html

+1

, ? - Parse. Parse, URI API GitHub :

{
  stored: <Date>,
  value: <stringified JSON returned from GitHub API call>
}

, - , Parse, , API. , API GitHub, Parse ( stored DateTime, ).

Parse , stored, , , , GitHub Parse. JSON value, .

, 14 GitHub API. , Parse cache.

0
source

Source: https://habr.com/ru/post/1529716/


All Articles