Repository navigation
Requirements and hosting
Redis is the default back end and the one I recommend. The following requirements cover a Redis installation.
| Need | Detail |
|---|---|
| PHP | 7.4 is the oldest version supported. The newest, PHP 8.6, is supported too. See PHP versions. |
| WordPress | 5.0 or later. See the table below for what each version unlocks. |
| PHP Redis extension |
phpredis, also packaged as php-redis or ext-redis. |
| A Redis or Valkey server | One your web server can reach. |
WP_CACHE |
Set to true in wp-config.php for the page cache. |
Optional:
- Brotli or zlib in PHP, to compress stored pages.
- PHP-FPM and curl, for the background render of live blocks (see Page cache).
- WP-Cron or a system cron that runs reliably. Background refresh after an edit runs from cron.
| Version | Notes | |
|---|---|---|
| Oldest supported | PHP 7.4 | The code is written to run on 7.4, and each release is held to that. |
| Newest supported | PHP 8.6 | The current release. The plugin has had dedicated work for it: see below. |
| Recommended | A PHP 8 release that still receives security fixes | Older versions run the plugin, but PHP itself is no longer patched |
Everything in between is supported.
Work done for the newest PHP, release by release:
| Version | What changed |
|---|---|
| 0.9.9 | Compatibility checks for PHP 8.6. A stored value that cannot be read, or whose class is no longer there, becomes a cache miss, not an error. |
| 0.9.10 | Writes of managed Apache rules are checked from start to finish, and a failed write is reported separately from a saved setting |
| 0.9.11 | Time budgets for cache clears and warming hold steady when the system clock changes |
The command line PHP is often a different version from the one your web server runs. Check both have the Redis extension. See WP-CLI.
| WordPress | Object and transient cache | Page cache and minification | Block cache |
|---|---|---|---|
| 5.0 to 6.4 | yes | no, pages render live | no |
| 6.5 to 6.8 | yes | no, pages render live | yes |
| 6.9 and later | yes | yes | yes |
The page cache stores the page from WordPress's own response buffer, which arrived in 6.9. On older versions the page cache settings are kept for when you upgrade, and nothing is stored or replayed in the meantime.
On Debian or Ubuntu:
sudo apt install php-redisThen restart PHP-FPM or your web server. Check both the web and command line PHP have it, since they can be different versions:
php -m | grep -i redisWith the Redis back end selected, a missing extension leaves the site serving uncached pages and raises a notice in wp-admin.
The simplest setup, and the fastest. Host 127.0.0.1, port 6379. If Redis listens on a Unix socket that PHP can read, the drop-ins try the socket first; the default path is /var/run/redis/redis.sock and ACEREDIS_SOCKET changes it.
Give Redis a memory limit and an eviction policy that suits a cache, for example:
maxmemory 512mb
maxmemory-policy allkeys-lru
Enter its host and port. Keep it on a private network and set a password. If the server uses access control lists, enter the user name too. Network latency is paid on every cache read, so keep it close to the web server. If a remote read is expensive, the local memory tier can hold a short-lived copy of the autoloaded options.
Managed Redis and Valkey services work, including Amazon ElastiCache.
- Tick TLS Encryption if the service requires TLS in transit.
- Managed cluster-mode and serverless endpoints are supported. These present the cluster behind one address. Every command the plugin sends names a single key, and reads that used to span keys are sent one key at a time, so the server never refuses a command for crossing slots.
- For the page cache drop-in, set the address in
wp-config.php. Use thetls://prefix for TLS:
define( 'ACEREDIS_PAGE_HOST', 'tls://my-cache.example.cache.amazonaws.com' );
define( 'ACEREDIS_PAGE_PORT', 6379 );You are responsible for the service you choose: its cost, its terms and where it keeps data. The plugin sends it cache keys and the data being cached, which can include site content.
If your Redis runs under Sentinel, give the plugin your sentinels and the service name, not a fixed Redis address. Each time it connects, the plugin asks the sentinels which server is the primary and connects to that, in the plugin and in both drop-ins. After a failover the next request finds the new primary by itself.
On the Connection tab:
| Field | What to enter |
|---|---|
| Sentinel addresses | One host:port per line, up to ten. The port is 26379 if you leave it off. |
| Sentinel service name | The name the sentinels know the primary by |
With both set, the Redis Host and Redis Port fields are not used. The username and password are still the Redis server's own.
The page cache drop-in runs before WordPress and cannot read settings, so with the page cache on, add the constants too. The settings screen and Site Health print the exact lines:
define( 'ACEREDIS_SENTINELS', '10.0.0.1:26379,10.0.0.2:26379,10.0.0.3:26379' );
define( 'ACEREDIS_SENTINEL_SERVICE', 'mymaster' );If the sentinels themselves need a password, define ACEREDIS_SENTINEL_PASSWORD. There is no setting for it.
If no sentinel can name a primary, the site carries on uncached and the header says BYPASS; reason=redis_unavailable.
Two limits:
- Sentinel is not combined with
ACEREDIS_PAGE_HOST. - A local socket is never tried when Sentinel is on.
For a self-managed cluster, open Connection > Redis Cluster nodes and enter one or more seed addresses, one host:port per line. The plugin discovers the other nodes. Use database 0. Cluster nodes take precedence over both Sentinel and the single-server address. Leave the field empty for a managed service that gives you a single endpoint.
For the early page cache, add the seed list shown on the settings screen to wp-config.php. For example:
define( 'ACEREDIS_CLUSTER_NODES', '10.0.0.1:7000,10.0.0.2:7000' );The plugin and both drop-ins use those seeds. Status and Site Health report each primary. If any primary stops answering, the plugin treats the cluster as unavailable and serves pages uncached.
Several sites can share a Redis. Give each its own database number, on the Connection tab and as a constant for the page cache drop-in, so their keys and flushes never meet:
define( 'ACEREDIS_DB', 3 );Page keys include the site's host name and object cache keys carry a per-site prefix and generation number, so sites sharing a database do not read each other's entries. A separate database is still cleaner, and it lets you inspect or empty one site alone.
Cluster-mode servers only have database 0. There, rely on the per-site keys.
If your host has no Redis and your site runs on one web server, you can use the PHP APCu extension. Select APCu under Connection > Back end. The cache lives in that server's PHP memory and starts empty whenever PHP restarts. Set up Redis if several web servers need to share entries.
Enable APCu in the PHP used by the web server. Give the web server and the user running WP-CLI write access to wp-content/cache/aceredis/ so a command or system cron job can pass changes to the next web request. A Redis outage never switches the site to APCu automatically.
- Redis or Valkey, at the address you configure, while caching is enabled.
-
Varnish, only if one is found on
127.0.0.1:6081or you name one. See Varnish and CDNs. - Your own site, when it warms or refreshes pages.
- Cloudflare, if you enable the integration for your zone.
Nothing is sent to me or to any service I run. There is no telemetry and no licence check.
For 0.13.0 I tested PHP 8.5.12 and 8.6.0, both using phpredis 6.3.0 and igbinary 3.2.16, on a two-site WordPress 7.1.5 installation with WooCommerce 11.3.1. Each runtime read the other’s cached pages, transients and sessions. In each direction a WP-CLI warm also produced an early guest hit on the other FPM pool. Use the same serialiser and install the matching decoding extensions wherever your web servers and scheduled jobs share Redis.
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
