query-monitor
query-monitor copied to clipboard
Track cache add, edit and delete
Add a panel that tracks the wp_cache_add, wp_cache_delete and wp_cache_set function calls. This would have to be an opt in feature.
This would be very useful, unfortunately there aren't any hooks in core to track this. Need to get some actions added to core, but also bear in mind the fact that these functions are pluggable by caching plugins.
Couldn't we just detect if there is already an object cache file. If there is no object cache enabled, override the memory cache object file with our own. This override, could have the hooks / filters that we need to do the requested. This is simple to how database case is overridden. Does that make sense?
We could do yeah but I think that affects the state of wp_using_ext_object_cache()
. Would need to do some juggling there I think.
wp_using_ext_object_cache
can be called and set to false, is that is a problem.
We could also just extend the WP_Object_Cache
class and override $GLOBALS['wp_object_cache']
. That would also work. Similar to this.
https://github.com/johnbillion/query-monitor/blob/ff52a9573e9aa465c2faf47a682c88f6070f2b97/wp-content/db.php#L157