Disable OPcache within W3TC
-
Hello,
I am running a WordPress Multisite with W3 Total Cache, and have been running into performance issues due to W3’s clearing of OPcache.
I’m finding that OPcache is flushed every time I publish or update a page, an unnecessary action which is having a significant impact on my site’s performance. I would like to disable this automatic flushing of OPcache – or at the very least reduce the frequency at which it is flushed.
So far I have had success eliminating the OPcache flush while preserving the flush of the other caches by making the following adjustment to SystemOpCache_Core.php:
public function flush() { if ( Util_Installed::opcache() ) { return opcache_reset(); } else if ( Util_Installed::apc_opcache() ) { $result = apc_clear_cache(); // that doesnt clear user cache $result |= apc_clear_cache( 'opcode' ); // extra return $result; } return false; }to:
public function flush() { return false; if ( Util_Installed::opcache() ) { return opcache_reset(); } else if ( Util_Installed::apc_opcache() ) { $result = apc_clear_cache(); // that doesnt clear user cache $result |= apc_clear_cache( 'opcode' ); // extra return $result; } return false; }Naturally I would prefer a solution that does not require modifying the plugin’s code. Is there a configuration that I can apply to W3TC or my php.ini which would eliminate the automated OPcache flush within W3TC?
The topic ‘Disable OPcache within W3TC’ is closed to new replies.