Open robinmetral opened 4 years ago
This would really be lovely - potentially a huge time-saver.
Cache API by itself very easy to use:
let obj = await cache.get(cacheKey)
...
await cache.set(cacheKey, obj)
Though I am not sure how complex will it be to use it for each and every fetched image.
That sounds great @Vacilando! I've been pushing this back because I never really used the Gatsby cache explicitly 😅—do you want to open a PR for it?
@robinmetral I've looked into caching imageFile
in onCreateNode()
- then realized that if the Gatsby flag PRESERVE_FILE_DOWNLOAD_CACHE the image files are already being used from cache (thanks to the use of plugin gatsby-source-filesystem).
Where else do you see we could use caching to improve the cache efficiency?
Thanks for your interest in this project. This plugin is moving into the Gatsby User Collective and this repo will be archived. Please open an issue in that repository, submit a PR if you'd like to see this implemented, or Join us on Discord if you have questions!
This is already handled by Gatsby pretty well, but the Cache API can be leveraged to make sure the pulled images are persisted between builds.
Relevant Gatsby PRs about caching for plugins:
Relevant docs: