Closed spencersmb closed 1 year ago
@spencersmb are you installing the plugins from the WordPress.org repo or some other way (composer? cloning from Github, etc)?
Could you provide clear steps to reproduce?
I have both plugins active and am not seeing this error message so I'm curious if there's a specific install path that leads to this?
Hi @jasonbahl - Thanks for the quick response. I was able to get around the issue by installing the plugin via the search field using the plugin directory inside Wordpress. I had originally made a git clone of the repo and tried to install manually by uploading the zip file.
I'm however struggling a bit with the cache invalidation. I have a blog with over 600 blog posts that I'm trying to keep cached for 24 hours for testing and development right now. I set the max-age to 24 hours, and then I set the object-cache to 23hrs. But I couldn't get the object cache to clear out when I updated a post. So I cleared the cache and rebuilt it after setting the object-cache back to 600 but kept max-age to 24 hrs. Now when I update a post everything works seamlessly. Is this the right way to do it? Basically my goal is to not keep rebuilding the cache unless I need to do so manually while posts and pages or parts of Wordpress - update and invalidate their individual queries /parts of the cache. Is this an accurate way to think of how the cache should work?
Side-not: I'm loving how this works so far that I was able to completely remove my cache setup from a company called Stellate. Their cache works really fast, but I can never seem to get it to stay cached for more than 5 min even after changing all the settings. And then when I deploy it will apparently miss all my cached data if I built locally so its kinda like whats the point. All this to say - wow what a great job you've done keeping Wordpress up to speed with the modern web dev scene and making it possible without having to jump into a major SAAS platform.
Thanks so much!
I set the max-age to 24 hours, and then I set the object-cache to 23hrs. But I couldn't get the object cache to clear out when I updated a post. So I cleared the cache and rebuilt it after setting the object-cache back to 600 but kept max-age to 24 hrs. Now when I update a post everything works seamlessly. Is this the right way to do it?
@spencersmb Ya, sounds about right!
Are you doing GET or POST requests for your queries? And what host is your WordPress site on?
My recommendation to get the most out of WPGraphQL Smart Cache is to host on a site that has network cache support for WPGraphQL Smart Cache. WP Engine supports this, or if you're on a host running Litespeed Cache this additional plugin adds support for those servers.
With network cache, you can do GET requests and the network cache layer (Varnish, Litespeed, etc) will return the cached results and WordPress won't be hit at all. This is ideal, in my opinion.
When using GET requests and the network cache, you can (in many cases) disable the object cache setting altogether. The "Max Age" setting will set the value that is returned in the headers of a GET request and the network cache will cache for that long or until a purge event is called.
With object cache and POST requests, the results are stored in the WordPress object cache (or transients if there is no persistent object cache available) and are returned from there, which means that WordPress is still hit for each POST request and the limits of the cache are likely lower and will likely lead to cache evictions more often.
I had originally made a git clone of the repo and tried to install manually by uploading the zip file.
@spencersmb ah ya, so this plugin has some un-versioned dependencies so if you clone it, you need to install the composer dependencies.
I recommend installing either from the repo, like you've done, or wpackagist if using composer, or getting the bundled .zip file from the latest release.
I'll close this as it seems the original issue has been resolved.
Thanks for the kind words! Excited to see you finding success with this stack 🙌🏻
@jasonbahl - Thank you so much for the help and the advice.
Right now I'm a WPEngine subscriber, for almost the last 8 years - they are awesome. The 2 queries I'm testing with in my next.js app are both setup using Apollo with Network-Only enabled and useGETForQueries set to true. I haven't converted all my fetch requests over yet, but these two were my biggest and most used (Getting Post data). In the settings of Wp Cache I have checked the Object cache and its definitely working when testing just in the browser. Blows my mind, so again, very nice solution you've created!
I need to read up on setting up individual GraphQL Documents and how that can help me with my larger or more frequent Get requests.
I'll be excited to see when you come out for batch request support because my blog Posts have a ton of Data I'm fetching, custom additional data using ACF, which I've hit the limit on query size for a single Post request. For now I'm just making a series of individual requests that make up my whole post object, and once it's cached, is ridiculously fast - even on revalidation for ISR.
Thank you again for the support today!
I have a wordpress environment installed on Wpengine with the Wpgraphql plugin and I tried to install the smart cache plugin. I couldn't get it to activate because it kept telling me I had the wrong WpGraphql version installed, even though I have the latest version installed. Any help would be greatly appreciated!