DEV Community

Discussion on: Gatsby with WPGraphQL, ACF and Gatbsy-Image

Collapse
 
robmarshall profile image
Robert Marshall

I needed my build to cache images so I adapted your resolver. I have written a walk through - hopefully it can help you like you helped me!

thoughtsandstuff.com/gatsby-with-w...

Collapse
 
parthp1808 profile image
Parth Patel

Anyhow, we can implement this kind of cache for posts as well? Rebuilding unchanged pages increases build time for larger blogs

Collapse
 
henrikwirth profile image
Henrik Wirth

You can use the new gatsby-source-wordpress@v4 which already does a lot of work for you when it comes to incremental builds.

github.com/gatsbyjs/gatsby-source-...

Collapse
 
henrikwirth profile image
Henrik Wirth

Super nice. If I may I'll reference your article, so people won't miss on this.

Collapse
 
robmarshall profile image
Robert Marshall

No worries. Just link back!

Thread Thread
 
henrikwirth profile image
Henrik Wirth

Hey Robert, I was wondering as I am trying your caching solution, isn't gatsby-source-filesystem already caching the images? I just tested it and for me it already caches the them.

Thread Thread
 
robmarshall profile image
Robert Marshall

I was contacted by Kyle Mathews saying the same thing. In the majority of situations Gatsby seems to cache and check itself. My version is 'slightly' faster, and handles the unlikely edge case of servers not using etags.

The conversation: twitter.com/robertmars/status/1172...

I suppose it depends on your environment. I quite like skipping the server checks, as it seems like an extra step.

Thread Thread
 
henrikwirth profile image
Henrik Wirth • Edited

Interesting. Also I guess it could be useful to write some custom caching, to persist the image-cache over gatsby. So if gatsby clears its cache, it will still be there. This would be interesting for peeps with gigabytes of Media-Files on their WordPress, who want to make sure, that they never ever have pull everything in again.

I'll update some info in this post. Thanks for the explanation.