Repository navigation
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.
wp aceredis statusSays 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"wp aceredis enablewp aceredis disableenable 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.
wp aceredis flushFlushes 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 --blocksAnother site's keys on the same Redis are never touched.
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.
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.
wp aceredis warm status --format=json
wp aceredis warm run --limit=20When 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.
wp aceredis dropin statuswp aceredis dropin install allwp aceredis dropin remove advancedinstall 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.
wp aceredis varnish statuswp aceredis varnish testwp aceredis varnish flushstatus 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.
wp aceredis opcache statuswp aceredis opcache flushwp aceredis opcache warm --waitPHP 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.
wp aceredis settings export settings.jsonwp aceredis settings import settings.json --dry-runexport 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.
wp aceredis block-cache statsShows, 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=jsonwp aceredis block-cache flushRetires every stored block. Pages are not touched.
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.
wp aceredis autoload-topLists the 20 largest autoloaded options with their size in bytes.
wp aceredis trim-autoload --names=some_plugin_log,another_big_optionSets 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.
Flush only the object cache with wp aceredis flush --objects, or WordPress's own command:
wp cache flushTo 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 ) );'Background refresh after an edit runs from cron. To run what is due now:
wp cron event run --due-nowTo see the plugin's scheduled events:
wp cron event list | grep aceredisFor 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 clearTraining 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
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
