Repository navigation
Drop ins
A drop-in is a file WordPress loads from wp-content before any plugin. Ace Redis Cache has two.
| File | Loaded | What it does |
|---|---|---|
wp-content/object-cache.php |
On every request, as WordPress starts | Replaces WordPress's in-memory object cache with one backed by Redis |
wp-content/advanced-cache.php |
On every request, only when WP_CACHE is true
|
Looks for a stored copy of the page and, with early serve on, answers with it before WordPress loads |
The originals live in the plugin at assets/dropins/. The copies in wp-content are what WordPress runs. Both files changed in 0.11.0. Update the pair together if you keep them in version control.
The plugin does, when you save the settings:
| Drop-in | Installed when | Removed when |
|---|---|---|
advanced-cache.php |
Page Cache is on | Page Cache is turned off |
object-cache.php |
Transient Cache is on | Transient Cache is turned off |
Each file is written to a temporary name and renamed into place, so a request never sees half a file.
-
A drop-in from something else. If
object-cache.phporadvanced-cache.phpexists and does not carry the Ace Redis Cache name, it is left exactly as it is. Remove the other cache through its own settings first, then save the Ace Redis Cache settings again. - Symlinks. A symlinked drop-in is never replaced or removed.
- Anything that is not a regular file.
When a write fails, for example because wp-content is not writable, an error notice appears in wp-admin and the write is tried again on a later save.
The Caching tab shows each drop-in's state:
| State | Meaning |
|---|---|
| Active and up to date | Installed, loaded, matches the plugin's copy |
| Installed and up to date (inactive) | Installed but not being used, for example WP_CACHE is off |
| Active and outdated | Loaded, but older than the plugin's copy. Press Update Drop-in. |
| Foreign drop-in detected | The file belongs to something else. The plugin will not overwrite it. |
From WP-CLI:
wp aceredis dropin statusOr compare the two copies by hand:
cmp wp-content/object-cache.php wp-content/plugins/ace-redis-cache/assets/dropins/object-cache.phpcmp wp-content/advanced-cache.php wp-content/plugins/ace-redis-cache/assets/dropins/advanced-cache.phpNo output means they match.
On the first request after an update or a deploy, of any kind, the plugin replaces the drop-ins it owns with the new versions. Before 0.10.6 that waited for an administrator to load a wp-admin page. Only files that already exist and already belong to it are replaced: an update never installs a drop-in you had turned off.
If each deploy builds a fresh wp-content, the drop-ins must be part of the deploy. The simplest way is one command after the release is in place:
wp aceredis dropin install allOr commit them to the site repository and update them whenever you update the plugin, or copy them from the plugin as a deploy step:
cp wp-content/plugins/ace-redis-cache/assets/dropins/object-cache.php wp-content/object-cache.phpcp wp-content/plugins/ace-redis-cache/assets/dropins/advanced-cache.php wp-content/advanced-cache.phpAn older drop-in beside a newer plugin usually still works, but it is the first thing to check when behaviour does not match this wiki.
Deactivating the plugin removes object-cache.php and advanced-cache.php from wp-content, but only the copies that carry its own name. On a multisite network they are removed when the plugin is deactivated for the network. Activating again puts them back as your saved settings ask. Deleting the plugin removes them too, if they are still there.
Before 0.10.4 the drop-ins were left behind on deactivation and had to be removed by turning the caches off first, or by hand.
define( 'ACEREDIS_DISABLED', true );With that in wp-config.php both drop-ins stand aside without being removed: object-cache.php hands over to WordPress's own in-memory cache and advanced-cache.php returns at once. The settings screen still loads and says the switch is set.
The drop-ins start before WordPress has read its options, so they take their connection details from wp-config.php:
-
advanced-cache.phpusesACEREDIS_HOST,ACEREDIS_PORT,ACEREDIS_PASSWORD,ACEREDIS_DBandACEREDIS_SOCKET, or theACEREDIS_PAGE_*set when pages live on a different Redis. Without them it tries the socket at/var/run/redis/redis.sock, then127.0.0.1:6379. -
object-cache.phpreads the plugin's saved settings from the database when it can, and falls back to the same constants.
If your Redis is anywhere other than 127.0.0.1:6379 database 0, set the constants. See Constants and filters.
Ace Redis Cache: a page cache and object cache for WordPress, backed by Redis or Valkey. Written and maintained by Shane Rounce at AceMedia. Website · Repository · Issues · GPLv2 or later
Setting up
The caches
Your stack
Reference
Help
