Linux 软件免费装
Banner图

EffortLess Opcode and Object Cache

开发者 domclic
更新时间 2026年11月16日 21:17
捐献地址: 去捐款
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

object cache apcu memcached opcache redis

下载

1.0.10

详情介绍:

WordPress Site Health reports two performance items: "Opcode cache is not enabled" and "You should use a persistent object cache". This plugin reports the state of both and, where the server allows it, changes it. OPcache keeps compiled PHP code in memory. It is a setting of the PHP installation, so a plugin cannot install it. The plugin shows whether the extension is loaded, whether opcache.enable is on, the main OPcache settings and, when enabled, memory use, number of cached scripts and hit rate. If the extension is loaded but switched off and PHP runs as CGI or FastCGI/FPM, the plugin can add opcache.enable=0 to the .user.ini file in the WordPress folder, between marker lines, leaving other content of that file as it is. PHP does not allow a .user.ini file to switch OPcache on after the server started with it off, so the plugin shows the lines to put in php.ini or the host's PHP settings instead. Persistent object cache. WordPress core caches database results only during one request. With a drop-in file, wp-content/object-cache.php, the results are stored in Redis, Memcached, APCu or in files, and reused by later requests. The plugin writes that file from a template with your settings, and removes it again on request or when the plugin is deactivated. The drop-in implements the WordPress cache functions, including wp_cache_get_multiple(), wp_cache_flush_group() and the other multiple-key functions. How the cache behaves: Tabs and settings The page has one tab per cache. A green dot on a tab marks the cache that is active. A cache is "installed" when its PHP extension is loaded (Files needs no extension). Activate is only offered for installed caches. Only one object cache backend can be active at a time, because WordPress loads a single wp-content/object-cache.php; activating another backend replaces the drop-in. Buttons on a backend tab: Activate (tests the server with the tab's settings, then saves them and writes the drop-in; reads Save and update when the backend is already active; settings that fail the test are not saved), Save and test the connection (stores and reads back a value, writes no file, and saves the settings only if the test works), Flush the cache and Deactivate (both only for the active backend; Deactivate deletes the drop-in). Where the page is

安装:

  1. Upload the effortless-opcode-and-object-cache folder to /wp-content/plugins/, or install the zip from Plugins > Add New > Upload Plugin.
  2. Activate the plugin. On Multisite, network-activate it.
  3. Open the page (see "Where the page is").
  4. OPcache tab: read the status. If it is not enabled, follow the instructions shown: switching OPcache on is done in php.ini or at the host, not by the plugin.
  5. For the object cache: make sure a Redis or Memcached server is running and the matching PHP extension (redis or memcached) is loaded, or that APCu is enabled; with none of them, choose Files. Open the tab of the backend, enter the server details if any, and click "Save and test the connection".
  6. When the test succeeds, click "Activate". The cache is used from the next page load, and Site Health should stop reporting the missing persistent object cache.

常见问题:

I configured it but nothing happens.

  • The drop-in is used from the next page load after installing it.
  • "Drop-in loaded but the cache server is not reachable" means the server did not answer; the page shows the last error. Check host, port, password and that the PHP extension is loaded.
  • If another plugin or the host installed wp-content/object-cache.php, this plugin leaves it alone and says so. Remove that file first, or use the other cache.
  • APCu is often disabled for the command line (apc.enable_cli) and enabled for the web server; the test runs inside the web request, so it reflects the web server.
  • .user.ini is read by PHP about every five minutes (user_ini.cache_ttl). Some hosts lock opcache.enable; then the line has no effect.

Why can the plugin not just turn OPcache on?

OPcache is loaded when PHP starts. A plugin runs inside PHP after that and cannot load an extension. Through .user.ini it can only switch opcache.enable off: PHP refuses to switch it on after the server started with it off.

Does it work with page caching plugins?

An object cache and a page cache are separate layers and can be used together.

What happens when I deactivate the plugin?

The drop-in it wrote is deleted, so WordPress goes back to its per-request cache. A drop-in written by something else is never deleted.

Does it change the site's data?

No. The cache holds copies of data. Flushing it only makes WordPress read the database again.

Is the cache shared between several sites on one Redis server?

Keys start with a random salt created for this installation, so two installations do not read each other's entries even in the same Redis database.

更新日志:

1.0.10 1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0