Home » What is WordPress Guide » WP-CLI » Full page cache and Redis cache management using WP-CLI

Full page cache and Redis cache management using WP-CLI

flusing the redis cache with wp-cli

Anything possible to do in the WordPress Admin Dashboard (wp-admin) is also possible directly from the WordPress Command Line Interface (WP-CLI).

As savvy WordPress admins well know, WordPress has developed a robust command line toolset for interacting with the platform using WP-CLI. The provided commands will make site changes and updates much easier when you use the command line from Terminal or PuTTY.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

Cache management from WP-CLI

If you are hosting your WordPress sites on Managed WordPress or Managed WooCommerce at Liquid Web, you have access to the additional WP-CLI commands it supports.

One of the most helpful commands is being able to flush all known caches. In fact, all of the various flushing commands for purging the caches (all caches, page caches, object caches, and asset caches) are extreme helpful for WordPress admins:

Managing Redis cache and full page cache together

Redis caching and Nexcess full page caching operate at the same to achieve two types of site caching:

  1. Full page caching. A full page caching plugin would use disk-based static HTML caching, improving the load time for site users and reducing the PHP worker usage on your server, which is a double win.
  2. Object caching. This caching from the Redis caching solution can improve database query performance both on the front end of your site and in wp-admin. Redis object caching is helpful for dynamic sites such as those running a membership site or WooCommerce.

Full page cache features in WordPress

Without full page caching, content on a WordPress site would require that the database stored post content is rendered out using PHP so that it is displayed on the page or posted on the site for the site user.

When page caching is enabled, the page, post, or say, a product in WooCommerce would already be rendered out as static HTML. Since static HTML will be faster in displaying the content that otherwise requires rendering from PHP, each request from a site visit will provide a quicker site experience.

Redis cache features for object caching in WordPress

Redis is used for object caching, meaning that the second time a database query comes in on the site, it would be served from Redis, leading to improved database performance. Redis also helps a site by being able to cache dynamic parts of a site — this would not be possible within full page caching.

Minification of CSS and JavaScript assets

Not technically caching but supplemental to full page caching and Redis caching, is the minification of Cascading Style Sheets (CSS) and JavaScript (JS) assets. Many themes and page builder plugins include performance options which include CSS generation for improved front-end performance.

For example, Elementor and Beaver Builder page builder plugins include CSS generation to enhance the front-end load times for sites using those plugins. A commonly used plugin for minification is Autoptimize which can minify CSS and JavaScript of files generated on the site’s active plugins and the active theme.

WP-CLI commands for enabling or disabling Redis object caching

Nexcess full page caching and Redis object caching can be enabled from the WP-CLI using the commands listed below.

Enabling both Redis object cache and Nexcess page cache management

The WP-CLI command to run to enable both Redis and Nexcess page caching is the following:

wp nxmapps cache enable –all

Enabling Nexcess page cache management only

The WP-CLI command to run to enable the Nexcess full page caching only is the following:

wp nxmapps cache enable page

Enabling Redis object cache management only

The WP-CLI command to run to enable only Redis object caching is the following:

wp nxmapps cache enable object

Disabling Redis object cache and Nexcess page cache management

Since full page caching and Redis object caching can be enabled from the WP-CLI, they both can also be disabled using the command line. See the sections below for the commands involved.

Disabling both Redis object cache and Nexcess page cache management

Use the following command syntax to disable both full page caching and Redis object caching with a single command:

wp nxmapps cache disable –all

Disabling Nexcess page cache management only

To disable the Nexcess full page caching feature only, run this WP-CLI command:

wp nxmapps cache disable page

Disable Redis object cache management only

To disable Redis object caching only, this WP-CLI command can be used:

wp nxmapps cache disable object

Purging different types of caching

Being able to purge different types of caching is also possible from WP-CLI using the command set for flushing the cache or caches.

Flushing all known full page caching plugins

The following command will flush all known created caches for the full page caching plugins listed here:

wp nxmapps cache flush page

Flushing all of the caches

The following WP-CLI command can be used to flush all of the caches then:

wp nxmapps cache flush –all

Flushing only the Redis object cache

This WP-CLI command can be used to flush only the Redis object cache:

wp nxmapps cache flush object

Flushing generated CSS assets

Suppose you use a plugin for minification or a page builder plugin that generates its own specific CSS. Those assets can be flushed using the following command for the plugins listed here:

wp nxmapps cache flush assets

Getting started

Managed WordPress hosting from Liquid Web includes an easy one-click staging site creation, the plugin performance monitor feature to pinpoint which plugins are causing performance problems on your site, and low-cost Elasticsearch containers to improve your site’s search by using the ElasticPress plugin.

Proactive server monitoring and support from WordPress experts 24/7/365

Maximum speed with free Object Cache Pro, premium image compression, and a built-in CDN.

If your site runs the WooCommerce plugin on it, then you can benefit from using the WooCommerce automated testing feature to test that your store is working as expected. As the help article for the WooCommerce automated testing feature reveals, with daily testing, it will use a hidden test product to check that it can be added to the cart and purchased. A functional cart and checkout are essential for a WooCommerce store.

Ready to upgrade your WordPress experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy. Liquid Web’s WordPress hosting options configure business-class servers and support plans specifically for WordPress websites.  

Click through below to explore all of our hosting for WordPress options, or chat with a WordPress expert right now to get answers and advice.

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Additional resources

What is managed WordPress hosting? →

Get details and decide if managed WordPress hosting is right for you.

Must-have web development plugins to create WordPress websites at scale →

Explore the best web development plugins to enhance functionality, improve performance, and streamline your WordPress site.

A complete guide to WordPress shortcodes →

Shortcodes make life easier. Learn how to get started!