Skip to content
Shane Rounce edited this page Nov 30, 2026 · 8 revisions

WP-CLI

The plugin adds its commands under wp aceredis.

For the recommended Redis setup, run WP-CLI with a PHP that has the Redis extension. The command line PHP is often a different version from the one your web server uses:

wp eval 'var_dump( extension_loaded( "redis" ) );'

On multisite, add --url= for the site you mean.

Status

wp aceredis status

Says whether the cache is on, whether Redis answers, and the state of each drop-in. Add --format=json for scripts.

Status also shows the selected back end, the local memory tier and the cache warmer. For Redis Cluster, check the Redis Cluster row for the primaries.

With Sentinel in use it adds a Sentinel row: the service, the current primary and when that last changed. The JSON gains a sentinel object with service, sentinels, primary, previous and since.

It exits with an error when the cache is on but Redis is not answering, so it works as a health check in a deploy or a monitor:

wp aceredis status || echo "cache is on but Redis is not answering"

Switching on and off

wp aceredis enable
wp aceredis disable

enable tests the connection first, as the settings screen does, and refuses if Redis does not answer. --skip-test switches on without the test, for hosts where the command line cannot reach Redis but the web server can.

Flushing

wp aceredis flush

Flushes this site's cached data. With no option, everything. Choose parts with:

Option Flushes
--pages Stored pages
--objects The object cache
--blocks The block cache
wp aceredis flush --pages --blocks

Another site's keys on the same Redis are never touched.

Purging pages

wp aceredis purge https://example.com/pricing/ https://example.com/contact/

Deletes the stored copies of one or more pages. The next visitor to each gets a fresh render.

Refreshing pages

wp aceredis warm https://example.com/news/

Refreshes pages in place: the stored copy is kept and served until the new one is ready. With no URL, the home page. --mark-only marks the pages stale without rendering them now, so they refresh when next visited.

Use warm when content changed and purge when a page must not be shown again. See Purging and refresh.

Cache warmer

wp aceredis warm status --format=json
wp aceredis warm run --limit=20

When popular-post ranking is enabled, last.popular_checked in the JSON status counts how many ranked URLs the last batch checked.

status reports the schedule, cursor and last batch. run checks the next batch even if scheduled warming is off. It still observes the pause filter and load limit. Missing pages go to the normal background refresher. Add --now to run a refresher batch immediately. Any pages it cannot finish stay queued.

On the single-server APCu back end, command-line PHP cannot see pages held by the web server. A command-line or system cron pass can therefore queue pages already stored. The web request running WP-Cron can check them directly.

Drop-ins

wp aceredis dropin status
wp aceredis dropin install all
wp aceredis dropin remove advanced

install and remove take object, advanced or all. Only the plugin's own drop-ins are managed: a drop-in that belongs to something else is never touched. This is the command to run after a deploy that rebuilds wp-content. See Drop-ins.

Varnish

wp aceredis varnish status
wp aceredis varnish test
wp aceredis varnish flush

status lists each Varnish server and its last purge result, test checks each one answers, and flush bans the whole site. All three take --format=json. See Varnish and CDNs.

OPcache

wp aceredis opcache status
wp aceredis opcache flush
wp aceredis opcache warm --wait

PHP on the command line keeps its own OPcache, separate from the one your web server uses, so clearing it from a shell normally changes nothing on the site. These commands send a short-lived signed request to your own site, so the web server does the work on its own OPcache. Turn on OPcache Helpers in the settings first. Only code inside this site is ever invalidated.

Settings

wp aceredis settings export settings.json
wp aceredis settings import settings.json --dry-run

export writes the settings as JSON, to a file or to the terminal. The Redis password is left out unless you add --with-password.

import reads a file back. Only settings this version knows are imported, a file without a password keeps the one the site already has, and an import that would switch the cache on or point it at another Redis tests the connection first. --dry-run shows what would change.

Block cache

Stats

wp aceredis block-cache stats

Shows, for each cached block type: hits, misses, average render time on a miss, render time saved and database queries saved. Then a total.

Option Meaning
--days=<n> How many days to include, 1 to 8. Default 7.
--format=json Output JSON with the enabled state and the stats
wp aceredis block-cache stats --days=1 --format=json

Flush

wp aceredis block-cache flush

Retires every stored block. Pages are not touched.

Autoloaded options

Options marked to autoload are read on every request and are part of what the object cache stores. A bloated autoload set makes every uncached request slower, and can grow past what the object cache will hold in one value.

See the largest

wp aceredis autoload-top

Lists the 20 largest autoloaded options with their size in bytes.

Stop options autoloading

wp aceredis trim-autoload --names=some_plugin_log,another_big_option

Sets the named options to not autoload. They still exist and are still read when asked for. Options WordPress cannot start without (siteurl, home, active_plugins, rewrite_rules, cron and a few more) are refused.

Only do this for options you recognise. An option that is read on every page is better left autoloaded.

The object cache

Flush only the object cache with wp aceredis flush --objects, or WordPress's own command:

wp cache flush

To mark every page stale and let the refresher rebuild them, for example after a deploy:

wp eval 'var_dump( aceredis_soft_purge_page_cache( true ) );'

Cron

Background refresh after an edit runs from cron. To run what is due now:

wp cron event run --due-now

To see the plugin's scheduled events:

wp cron event list | grep aceredis

Next-post prefetch

For WordPress 6.8 and later, prepare a CSV with the headings from_post_id,to_post_id,count and one row per pair. Use two distinct periods from site-wide counts you have permission to use. Keep the later period for evaluation.

wp aceredis navigation train earlier.csv
wp aceredis navigation evaluate later.csv
wp aceredis navigation clear

Training replaces the model on this site. Evaluation reports correct predictions, attempted predictions and total transitions. Compare correct with attempted for accuracy and attempted with total for coverage. Clear removes the model when you retire it. Refresh cached post HTML and any outer page cache after changing the setting or model. Model requirements and browser exclusions

The 0.13.1 source includes a disposable WordPress and Chromium benchmark for comparing predicted hits and misses against WordPress's normal conservative prefetch rule. Its results include navigation timing, document bytes and unused prefetches. Evaluate your own model with a separate time period of aggregate counts before comparing its performance. Run the paired browser benchmark

Clone this wiki locally