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, and both will use asynchronously flushing if async_flush
is enabled. But be careful, these commands will erase any data stored in the selected Redis database. To avoid accidental data loss, use a separate database for the object cache and other application data.
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