Object Cache Pro

WP CLI

Object Cache Pro supports several WP CLI commands.

Status information #

To show the object cache status and diagnostic information use:

wp redis info

Drop-in #

To copy and enable the object cache use the wp redis enable command.

This command will fail if a object-cache.php already exists, to overwrite any existing drop-in use the --force argument.

wp redis enable --force

To disable the object cache, run:

wp redis disable

Flushing #

To flush the entire object cache use the flush command:

wp cache flush

But be careful, this will flush any data stored in the selected Redis database. To avoid accidental data loss, use a separate database for your object cache.

Asynchronous flushing #

To asynchronously flush the object cache, use the --async argument:

wp cache flush --async

Multisite flushing #

To flush an individual site in a multisite environment either supply the site’s ID or URL:

wp cache flush 42
wp cache flush --url="https://example.com"
wp cache flush 13 37 # flush site 13 and 37