wp-graphql / wp-graphql-smart-cache

Smart Caching & Cache Invalidation for WPGraphQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is network cache preferred to object cache?

maximilliangeorge opened this issue · comments

Hi, I'm testing out this plugin. I can get the object cache to work, but it's not really affecting the roundtrip time. Is it worth going through setting up network cache on my docker image, or would that only yield similar results? It's not clear from the docs if one or the other cache method is better than the other.

Thanks in advance!

Bonus question: I've installed a Redis Object Cache, in hopes of speeding up the WPGraphQL Smart Cache with object cache checked. However, I'm not noticing much of a difference here either… Not sure if WPGraphQL Smart Cache will use Redis Object Cache without further configuration or not.

Is it worth going through setting up network cache on my docker image, or would that only yield similar results

Yes, I think you will see significant improvement when using Network cache. Object cache is only really intended for folks that cannot use network cache.

You can see an example of the .vcl (varnish configuration language) we use to test against here: https://github.com/wp-graphql/wp-graphql-smart-cache/blob/main/docker/varnish/default.vcl

Not sure if WPGraphQL Smart Cache will use Redis Object Cache without further configuration or not.

I haven't explicitly tested with Redis Object Cache, but it should work.

That said, object cache still requires the full trip to the WP Server, WordPress needs to bootstrap and load cache from the WP server, so it will be slower than network cache.

Object cache is really only intended for folks that cannot use GET requests and take advantage of network cache (i.e. mobile app that already uses POST requests and can't update to use GET until users install an update, etc)

@maximilliangeorge I'm going to close this issue. If you're able to determine that for some reason this plugin is not actually compatible with the Redis Object Cache plugin and can provide clear steps to reproduce, open a new issue and reference this one.

Thanks Jason, your answers helped me :)