WP CLI

Object Cache Pro supports several WP CLI commands.

Enabling & disabling the dropin

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 dropin use the --force argument.

wp redis enable --force

To disable the object cache, run:

wp redis disable

Flushing the cache

Use the wp cache flush command to flush the entire object cache.

CAREFUL! This will flush any data stored in Redis. 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

Retrieve cache information

To show the object cache status and diagnostic information use:

wp redis info