Nexcess Logo

Full page cache and Redis cache management using WP-CLI

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
February 10, 2023

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.

Performing cache management from the WordPress Command Line Interface (WP-CLI)

If you are hosting your WordPress sites on Managed WordPress or Managed WooCommerce at Nexcess, you have access to the additional WP-CLI commands it supports. It is possible to enable full page caching at Nexcess using the Nexcess Page Cache feature along with the Redis object cache directly from WP-CLI.

Along with being able to disable the Nexcess page caching and Redis caching of objects — 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 for WordPress site performance

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.

About the need for 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.

About the need for 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.

About the minification of Cascading Style Sheets (CSS) and JavaScript (JS) 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 and Nexcess full page 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

Advantages of WordPress and WooCommerce with Nexcess as your hosting provider

Managed WordPress hosting from Nexcess 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.

The Nexcess MAPPS MU (must-use) plugin documentation contains a long list of "freebies and enhancements" you get "out of the box" by selecting Nexcess as your WordPress hosting company. For example, there is no need to buy Redis as a feature addon since Redis is included with Managed WordPress and Managed WooCommerce plans at no additional cost. The Nexcess Knowledge Base includes many other help articles for WordPress and WooCommerce.

Recent articles

Related articles

Luke Cavanagh
Luke Cavanagh

Luke Cavanagh, Strategic Support & Accelerant at Liquid Web, brings a decade of experience working with WordPress and WooCommerce to our product team. His GitHub page offers a glimpse into his multiple areas of subject matter expertise.

"Ninja stuff with WordPress and WooCommerce," is an apropos way to describe Luke's savviness with these platforms — and his way of influencing our organization for improving to them.

Coming out of the University of Brighton with a Business and Technology Education Council (BTEC) Higher National Diploma (HND) in 2D & 3D Design, Luke's credentials prepared him well for his current role that blends both web development and design. His HND credential leveraged his foundational learning at West Kent College, where is received a National Diploma (ND) in Graphic Design.

In his personal life, Luke is a devoted husband and teen wrangler. He considers himself a Synthwave enthusiast, Jerry Goldsmith fan, and Doctor Who aficionado. He is happy to introduce his friends and teammates to essential vocabulary for life found only in British English, such as "gubbins" and similar terms.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.