Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Cache API Requests #3051

Closed
marcobiedermann opened this issue Nov 28, 2017 · 2 comments
Closed

Question: Cache API Requests #3051

marcobiedermann opened this issue Nov 28, 2017 · 2 comments

Comments

@marcobiedermann
Copy link
Contributor

Is there a way to cache external API requests and and make a call every XX minutes / hours / days?
Most APIs have a request limit so a better approach would be to fetch external data, store it in DB / file system and read from that. Via timer or cronjob the store should be updated.

@calcsam
Copy link
Contributor

calcsam commented Nov 29, 2017

We think that's super important! Gatsby already does this. It fetches all data necessary at build-time. The diagram on
https://www.gatsbyjs.org/ illustrates this a bit.

Of course, your underlying data, whether it lives in a CMS or wherever, may change over time. If you control the data source, you can use webhooks to trigger a re-build whenever data changes. If you don't, you can trigger periodic rebuilds to pull in new data.

image

@calcsam calcsam closed this as completed Nov 29, 2017
@marcobiedermann
Copy link
Contributor Author

@calcsam Ah, thank you. Cool, I will give it a try!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants