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 redis flush

The wp cache flush works as well, but doesn’t support asynchronous or Multisite flushing.

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 redis flush --async

Multisite flushing

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

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