WP CLI

Object Cache Pro supports several WP CLI commands.

Status overview

To show the object cache status:

wp redis status

Diagnostics

To show the object cache diagnostic information use:

wp redis diagnostics

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 option.

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 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 option:

wp redis flush --async

Multisite flushing

By default wp redis flush will flush the entire network.

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"

# flush site 42 and 1337
wp redis flush 42 1337