| 开发者 | domclic |
|---|---|
| 更新时间 | 2026年11月16日 21:17 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
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:
incr and decr read, change and write the value; they are not atomic between simultaneous requests.wp-content/object-cache.php; activating another backend replaces the drop-in.
opcache.enable=0 to .user.ini in the WordPress folder, between marker lines; Remove the plugin's line takes the lines out again. If the extension is not loaded the tab explains that only the host can install it.tls://host, or the path of a Unix socket, in which case the port is ignored; default 127.0.0.1 and 6379), database 0 to 255 (default 0), and an optional password. The password field is always empty when the page loads; leaving it empty keeps the stored password, and a checkbox removes it. The password is stored in the plugin settings and written into wp-content/object-cache.php, because the drop-in loads before the database is available.127.0.0.1 and 11211).wp-content/cache/elooc-<salt>/. The files start with a PHP exit statement, and the folder has an index.php and an .htaccess. The files and folders can be read by the PHP user only. Expired files are removed gradually: about every five minutes one request spends up to a fifth of a second cleaning the next sub-folders, and a flush moves the old files aside to be deleted the same way. Reading a file is slower than reading memory, so this helps mainly when database queries are slow (for example a remote or busy database) and the disk is fast; on a host with a fast local database the gain can be small. It does make WordPress report a persistent object cache.effortless-opcode-and-object-cache folder to /wp-content/plugins/, or install the zip from Plugins > Add New > Upload Plugin.php.ini or at the host, not by the plugin.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".wp-content/object-cache.php, this plugin leaves it alone and says so. Remove that file first, or use the other cache.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.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.
An object cache and a page cache are separate layers and can be used together.
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.
No. The cache holds copies of data. Flushing it only makes WordPress read the database again.
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.
maybe_serialize() and maybe_unserialize(), wrapped in an array so that integers, objects and false keep their type.add() reports false when another request is adding the same key or the server refuses it.opcache.restrict_api allows it, instead of silencing their warnings.object-cache.php and .user.ini are written to a temporary file that is moved into place with WordPress's filesystem class.class-elooc-donate-notice.php.wp_json_encode().dropin folder and joined into wp-content/object-cache.php when it is written; the file written to wp-content has the same contents as before apart from the changes below.WP_Filesystem_Direct) for creating, writing, moving and deleting files instead of direct PHP calls, and the connection test of the Files backend writes its test file through the plugin's WP_Filesystem wrapper.wp_cache_flush() and wp_cache_flush_group() return false when the server did not accept the change, and the Flush button reports it.wp_cache_incr() and wp_cache_decr() keep the time the entry has left instead of resetting it to the default age.wp-content/object-cache.php and .user.ini are replaced through a temporary file and a rename, and the drop-in is checked for PHP syntax errors before it is written..user.ini to do that; the value is read only from the plugin's own lines, including in files with Windows line endings..user.ini.languages folder..user.ini when the extension is loaded.wp-content/cache, so a persistent object cache can be used where no Redis, Memcached or APCu extension is available. "Detect" uses it when none of the other three works..user.ini helper for OPcache, and an object cache drop-in for Redis, Memcached and APCu.