
Show HN: Clear OPcache – Our First WordPress Plugin - jessehorne
We (Binary Cocoa) have released our first WordPress plugin and would love to get feedback from the HN community.<p>It&#x27;s a simple plugin named Clear OPcache. When installed, it puts a Flush OPcache button in the top admin bar which allows you to flush the OPcache by clicking it. It will let you know if you don&#x27;t have OPcache enabled and will link you to documentation. It also clears the OPcache&#x2F;WinCache during a WordPress update.<p>It&#x27;s completely free and we&#x27;d appreciate any and all feedback. I appreciate your time!<p>https:&#x2F;&#x2F;wordpress.org&#x2F;plugins&#x2F;clear-opcache&#x2F;<p>https:&#x2F;&#x2F;binarycocoa.com&#x2F;
======
zelon88
Nice! It sounds like you put some thought into fit and finish.

I'm just unclear under what conditions would one want to flush the OPcache?
I've written countless lines of janky PHP experiments and never run into a
problem with caching. The only time I can think of flushing it would be on an
off-site server where you don't have the ability to reboot or restart PHP.
Does PHP wipe the OPcache and start over once it gets full?

~~~
jessehorne
Thanks for checking it out! The obvious answer is, you may want to clear it
when you have code changes that you'd like to see without restarting the
server. You can configure the opcache to never check if files have changed.
This makes it even quicker because it doesn't have to check modification times
on files. Unfortunately, if you do that, changes to your code aren't ever
going to be reflected. This can cause issues in wordpress whenever you update
plugins and such. The plugin we wrote automatically will notify php that it
needs to clear the opcache so that those changes can be reflected. This way
you can have the opcache configured for the highest performance without
suffering the drawbacks of not being able to easily update plugins
automatically.

~~~
jessehorne
Alternatively, you can configure the opcache to check mtime on files, but
there is a performance hit for doing that, since each request will be checking
the mtime on potentially hundreds of files before accepting that the cache is
up to date.

