LiteSpeed Cache v6.0 for WordPress
Introduction
LiteSpeed Cache v6.0 for WordPress is here, and we’ve got a bunch of behind-the-scenes improvements, a few bug fixes, and some nifty new features. You can see the full release log here, but today we’re going to focus on these great new settings and features:
- The Preload Featured Image setting in Page Optimization > Media
- The Vary Cookies setting in Cache > Advanced
- The new Crawler commands for the WordPress Command Line Interface (WP-CLI)
- Parallel Pull, an improved method of pulling images for Image Optimization
Preload Featured Image
When you instruct a browser to “preload” a resource, that resource is added to the front of the processing queue, and is loaded even before the browser begins to render the page. By preloading a resource, you can potentially eliminate it as a render-blocking element.
You can enable the new Preload Featured Image setting to allow your posts’ Featured Images to be preloaded in browsers that support it. This user-experience enhancement ensures that browsers display your most important image right away, with no waiting.
We’ve disabled this setting by default. To enable it from the WordPress Dashboard, navigate to LiteSpeed Cache > Page Optimization > Media Settings, and set Preload Featured Image to ON
.
NOTE: As of LSCWP v6.2, the Preload Featured Image option has been removed and the functionality folded into the ViewPort Images service. Any image that is detected to be a viewport image for a post is now automatically preloaded.
Vary Cookies
Before we talk about the new Vary Cookies setting, it’s helpful to understand the concept of cache varies in general, and the part that cookies play in that.
LiteSpeed Cache stores and retrieves cache objects using a Cache Key. An optional component of the cache key is the “vary string.” It’s this vary string that allows you to save multiple cache objects from the same URL. This is useful in a number of situations including those where the desktop and mobile views of a page are different, or where the currency displayed on a page varies by the visitor’s geographical location.
When you instruct the LiteSpeed Cache Engine to vary on a cookie, you are telling the Cache Engine to look for the cookie name, and then create cache varies based on the value of that cookie.
So, for example, let’s say you have a membership plugin that shows one set of shop prices to members and a different set of prices to non-members, and the behavior is governed by a _member
cookie. The cache engine could vary on the value of _member
. It would store two copies of your shop page in cache: one for “yes” and one for “no”. Or maybe the cookie has three potential values: “full,” “trial,” and “no.” In that case the cache engine could store three copies of the page.
LiteSpeed Cache can vary on any cookie you wish, and potentially create a separate version of the page in cache for each value of the cookie.
If you have a situation like this, you can instruct LiteSpeed Cache to vary on any cookie that you wish. Navigate to LiteSpeed Cache > Cache > Advanced and add the name of the cookie to the Vary Cookies setting. If you want to vary on multiple cookies, enter them one per line.
NOTE: Be careful not to vary on any cookie that uses a unique ID for each user as a value. This can potentially create an infinite number of copies of each page, and that will eat up your cache storage very quickly.
Why is this new setting a big deal?
Before Vary Cookies was added to the LiteSpeed Cache plugin, you could have defined some vary cookies for your site with a few lines in the .htaccess
file. By adding the setting to the plugin, your defined vary cookies are now passed along to QUIC.cloud CDN.
This is a big deal, because it means that your cookie-based cache varies exist at the CDN level. No other CDN can serve multiple cached copies of the same page based on a cookie value. But as of LSCWP v6.0, QUIC.cloud CDN can!
CLI Crawler
LiteSpeed Cache v6.0 comes with some new commands for the WordPress CLI. Now you can control the crawler from the command line!
WP-CLI is accessed with the wp
command, and all crawler instructions begin with litespeed-crawler
, so a complete WP-CLI crawler command would look like:
wp litespeed-crawler <instruction> <parameters>
There are five functions available:
- List:
list
orl
- Enable:
enable <crawler-id>
- Disable:
disable <crawler-id>
- Start:
run
orr
- Reset:
reset
For more information about the new CLI crawler functionality, and how to use each function, take a look at our documentation.
Parallel Pull
Do you use the Priority Line or Jumbo Group power-ups that are available for Image Optimization? If so, you may notice your pulled images sliding back into your WordPress more speedily than they used to.
This is due to Parallel Pull. Normally, when the cron pulls your optimized images back to your site, it downloads them one at a time. But users of those two power-ups now can expect multiple images to download at one time, potentially decreasing the time it takes to receive a batch of optimized images.
There is nothing you need to do to enable this behavior. It is on by default when you subscribe to Priority Line or Jumbo Group.
NOTE: These Image Optimization power-ups have been disabled as of September 1, 2024 in preparation for a new and improved Image Optimization service coming soon.
Conclusion
We’re always excited to bring you a new set of features and enhancements, and this release is no different. Install LiteSpeed Cache v6.0 for WordPress today and try it for yourself!!
Comments