Flush the object cache
The object cache can be flushed with the WP-CLI command wp cache flush
. WP-CLI commands must be run with VIP-CLI.
Caution
Use caution when flushing the object cache on a production environment. The performance of a site’s origin database server is protected by the object cache layer. Flushing the object cache can have negative performance implications, particularly during high traffic events.
Prerequisites
VIP-CLI is installed and has been updated to the most current version.
Command examples
VIP-CLI command examples
For demonstration purposes, the <app-name>
value example-app
and the <env>
value production
are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.
For WordPress single sites, the object cache can be flushed with the WP-CLI command wp cache flush
:
vip @example-app.production -- wp cache flush
For WordPress multisite environments, a specific network site must be targeted with the --url
parameter in order for wp cache flush
to successfully flush the object cache for that site.
vip @example-app.production -- wp cache flush --url=http://example.com
If wp cache flush
is run against a multisite environment without the --url
parameter, only the object cache of the main site (ID 1) will be flushed.
Flushing the object cache after a domain change
On a WordPress multisite, to fully flush persistent objects from the object cache multiple wp cache flush
commands might need to be run. For example, after a site launch or a domain change, the wp cache flush
command may need to be run for both the previous convenience domain value (e.g. example-app.go-vip.net
) and the launched custom domain value (e.g. www.example.com
):
vip @example-app.production -- wp cache flush --url=example-app.go-vip.net
vip @example-app.production -- wp cache flush --url=www.example.com
Last updated: May 14, 2025