Need a hook to prevent W3TC from flushing whole object cache on update_option
-
I have an issue with the way W3TC automatically flushes the whole object cache every time a site option is updated.
This happens in
/lib/WC/Plugin/ObjectCache.php
in theW3_Plugin_ObjectCache
object:function on_change_option($option) { static $flushed = false; if (!$flushed) { if ($option != 'cron') { $flush = w3_instance('W3_CacheFlush'); $flush->objectcache_flush(); $flushed = true; } } }
There is no way to hook in and prevent the flushing from happening for option updates, contrary to the post update flushing which offers a hook in the
w3_is_flushable_post
function.In my case, the problem is caused by the WP Slimstat plugin which updates the
slimstat_visit_id
option on every visit to the site. So the result is that my whole object cache gets flushed several times per minute, rendering it useless.So my question is, could possibly make a hook to prevent the object cache from flushing on every option update? Possibly by filtering on the option name.
Also I’m curious, why the need to flush the whole object cache on updates to a site option, or to all post updates? It seems to me that WP Core already uses the wp_cache_delete on a per item basis to invalidate all its entries in the object cache? Both when it comes to posts, meta, and options.
This issue has been discussed before here:
https://github.com/woothemes/woocommerce/issues/3014
- The topic ‘Need a hook to prevent W3TC from flushing whole object cache on update_option’ is closed to new replies.