What is OPCache?
Since WP Rocket 2.7, you might have seen a new option in the admin bar to Purge OPCache, if your server has PHP 5.5 or higher.
If you're wondering what is this option about, here is what you can read on the PHP manual for it:
OPCache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.
In other words, a PHP script when it is executed, is compiled into opcode, code that is understandable by the machine. OPCache stores this code into memory on the first execution, to be reused afterwards, thus leading to performance boosts.
OPCache replaces APC, and is an alternative to XCache, as a PHP accelerator.
WP Rocket enables you to reset the OPCache content easily if needed right from your WordPress admin bar.
The OPCache is not cleared automatically when you click Clear Cache button because it rarely has to be cleared.
I don't see the Purge OPCache link
If you don't have this option in the WP Rocket admin toolbar it means either:
- Your server hasn't been configured to use OPCache
~ or ~
- Clearing the OPCache via API isn't possible because of this restriction in php.ini:
In either case, talk to your host or server admin to enable these features.
I'm getting an "OPcache purge failed" message
WP Rocket currently support's the purge of memory-based OPCache.
If your host is using file-based OPCache, purging will not work, and the "OPcache purge failed." message will be displayed.
Contact your host, and ask them if they are using file-based OPCache. In case they do, the following WordPress plugin can clear both memory-based, and file-based OPCache: