We’ve created a new WordPress plugin that lets you more easily clear Cache - either by a click of a button in the plugin settings or you can set to automatically clear cache when new content is added.
Well, maybe saying we “created” is a little misleading… We forked the very handy NGINX Cache plugin to make it work better with Cleavr as well as to get around an issue with the NGINX Cache plugin which is that it doesn’t work when assigning a site to a different server user. The plugin unfortunately only works for the default NGINX user that it’s running on, which in Cleavr’s case is the ‘cleavr’ user.
With our new forked version, you can simply supply the clear cache hook that’s provided in the NGINX Cached section of Cleavr.
Would you like to try out the beta version of the plugin?
Awesome! Thanks so much for forking and improving this plugin for Cleavr users.
One thing that would be awesome if it could be improved, but not sure it’s possible, is that if you enable auto cache clearing on content changes (which I find it pretty essential in many cases) then when saving a simple single page instead of it being nearly instant, now takes several seconds (because I’m guessing the entire cache is being cleared at the same time?).
FastCGI cache works different than a Cache plugin in WordPress. I don’t think there is a way remove only a few “pages”. Or better from WordPress there is no way to address the specific files.
It would be great to keep the other cached files anyway. Because a bot or visitor need to access a page twice before the cached file is served.
It’s probably taking longer now due to the post request via the clear cache hook vs using the cache path where the operation would be quicker. We’ll see if there is a way to background or look for some other methods to make that part less noticeable
I’m also curious to see if we can target the cache for where the content is being changed, we’ll have to research that.
Hi,
it’s time for the first plugin update
Since Cleavr 2.0 the placeholder for the URL field on the settings page needs an update.
If you do so please add this attribute to the field as well: autocomplete="off"
Feature suggestion: Redirect to the settings page after plugin activation.
@amiedema he is right this error happens for me if I click “Clear cache” while the hook URL isn’t entered yet. Some validation would help here
The problem
Uncaught Error: Object of class WP_Error could not be converted to string in /home/user/mysite.nl/current/wp-content/plugins/cleavr-clear-cache/cleavr.php:101
is located here ($result is a WP error object)
error_log( 'Result Code: ' . $result );
I’m not sure if this is same error like Mike reported, but it’s a small bug that should be fixed