redis-cache
redis-cache copied to clipboard
"Object Cache" admin-bar node
How can this be the most useful?
- [ ] Toggle via options in settings
- [ ] Enabled by default?
- [ ] Disabled via
WP_REDIS_DISABLE_ADMINBAR
- [ ] Add with priority of 998, just before Query Monitor?
The node could be:
| Object Cache
| - Flush Cache
| - Show Metrics
| --------------
| Status: Connected
| 99.4%; 940/6; 98.09 KB
Related:
- https://onexa.nl/wordpress/toolbar-link-redis-object-cache/?v=3e8d115eb4b3
- https://wordpress.org/support/topic/fyi-flush-button-script-breaks-update/#post-13121765
@naxvog: Feedback?
See #272 as well.
I created this snippet, largely stolen from the WP OPcache plugin (https://wordpress.org/plugins/flush-opcache/), that seems to work for adding a button to the admin bar for clearing the Object Cache. I don't really know how to appropriately integrate it into redis-cache, but perhaps someone else could look over the code and work to integrate it here?
Otherwise, it can be added to your functions.php or a snippets plugin.
Things that definitely need review/contribution:
- how to use the add_settings_error part of the flush_objectcache_reset() function (I took this from the redis-cache code, but not sure how it works)
- add a setting and checkbox to the redis cache plugin settings page to turn this feature on/off
- look at the multisite stuff to make sure it works properly
- just review it all generally, as I essentially copy/pasted it all and changed opcache to objectcache
https://github.com/nickchomey/flush-object-cache/blob/main/flush-object-cache.php
This looks like almost exactly what I'm after :) I asked the question on the wordpress plugin support here: Admin Bar options please
An admin bar dropdown with disable / enable and flush object cache options would be an excellent addition. I realise some people aren't keen on admin bar dropdowns, so having it as an option you can deactivate as you suggest would probably be a good idea too.
Any idea when this might be availbale?