User Agents

Web browsers and everyday web tech, explained

LiteSpeed Cache: What It Is and How It Works

· 5 min read · Cookies and Cache

In this article
  1. Background and Origin
  2. How LSCache Works
  3. LSCache vs. Other Caching Plugins
  4. Common Problems and Misconceptions
  5. How to Choose and Use LSCache
  6. Cost and Hosting Requirements
  7. Frequently Asked Questions

LiteSpeed Cache (LSCache) is a server-level caching plugin and module developed by LiteSpeed Technologies, designed to speed up websites by storing fully rendered HTML pages and serving them to visitors without re-executing PHP or querying the database. It is primarily used with WordPress, but also supports other platforms like Magento, Joomla, and OpenCart. Unlike many caching plugins that operate at the application level, LSCache integrates directly with the LiteSpeed web server, making it faster and more efficient in many scenarios.

Background and Origin

LiteSpeed Technologies introduced the LiteSpeed Web Server (LSWS) in 2003 as a drop-in replacement for Apache, with a focus on high performance and scalability. The company later developed LSCache as a built-in feature of LSWS, allowing server administrators to enable caching without additional software. For WordPress users, the company released a free plugin called LiteSpeed Cache for WordPress in 2014, which provides a user-friendly interface to control the server-level cache. The plugin is now one of the most popular caching solutions, especially among hosts that use LiteSpeed servers, such as SiteGround, Hostinger, and A2 Hosting.

How LSCache Works

LSCache works by intercepting HTTP requests at the server level. When a visitor requests a page, the server checks if a cached copy exists. If it does, the server sends that cached HTML directly, bypassing PHP execution and database queries. If not, the server processes the request, generates the page, and stores a copy for future requests. This process is known as “full-page caching.”

Key features include:

  • Private Cache: Caches pages for logged-in users separately, so personalized content is not mixed with public pages.
  • ESI (Edge Side Includes): Allows parts of a page (like a shopping cart) to be cached separately, so dynamic sections update without invalidating the whole page.
  • Cache Invalidation: Automatically purges relevant pages when content is updated, such as when a new post is published or a comment is added.
  • Browser Cache: Sets HTTP headers to let browsers store static resources like images and CSS locally.
  • Object Cache: Caches database query results to reduce load.

LSCache vs. Other Caching Plugins

The main difference between LSCache and plugins like WP Super Cache or W3 Total Cache is the layer at which caching occurs. Most plugins generate static HTML files and serve them via PHP, which still requires some server processing. LSCache operates entirely within the web server, so it can serve cached pages even faster. Additionally, LSCache is often more efficient because it uses the server’s native caching engine, which is optimized for the LiteSpeed environment.

However, LSCache only works on servers running LiteSpeed Web Server or the open-source OpenLiteSpeed. On Apache or Nginx, the plugin will not function, and you would need to use a different caching solution. This is a crucial consideration when choosing a hosting provider.

Common Problems and Misconceptions

One common misconception is that LSCache is a standalone plugin that works anywhere. In reality, it requires LiteSpeed server software. Another issue is that users sometimes see outdated content because the cache is not purged correctly. This can happen if the plugin’s “Purge All” button is not used after major changes, or if the server’s cache lifetime is set too long.

Another problem is that LSCache can conflict with other caching plugins. Running multiple caching layers can cause issues like missing updates or broken functionality. The plugin itself warns against using other page caching plugins simultaneously.

Some users also report that LSCache does not work well with certain dynamic features, like real-time notifications or live chat, unless ESI is configured properly. However, these issues are rare and usually solvable by excluding specific pages or using ESI.

How to Choose and Use LSCache

To use LSCache, you need a hosting provider that runs LiteSpeed Web Server. You can check this in your hosting control panel or by asking support. Once confirmed, install the LiteSpeed Cache plugin from the WordPress repository. After activation, the plugin works with default settings, but you can optimize it further.

Basic steps to get started:

  1. Install and activate the plugin.
  2. Go to LiteSpeed Cache > General and enable the cache.
  3. Set a cache lifetime (e.g., 3600 seconds for one hour).
  4. Purge all cache after making significant changes to your site.
  5. Use the “Cache Excludes” tab to exclude pages that should not be cached, such as cart or checkout pages.

For advanced users, the plugin offers a “Presets” feature that automatically configures settings based on your site type (e.g., blog, e-commerce, or forum).

Cost and Hosting Requirements

LSCache itself is free, but it only works on LiteSpeed servers, which are typically offered by premium hosting providers. Some budget hosts may use OpenLiteSpeed, which is also free and supports LSCache, but may lack some advanced features. If your host uses Apache or Nginx, you cannot use LSCache and would need to rely on other caching methods.

There is no separate cost for LSCache; it is included with LiteSpeed Web Server licenses, which hosting providers pay for. For end users, the plugin is free to download and use.

Frequently Asked Questions

Is LiteSpeed Cache the same as LiteSpeed Web Server?

No. LiteSpeed Web Server is the actual web server software, while LiteSpeed Cache is a caching feature built into that server. The plugin is the interface that lets you control the cache from your WordPress dashboard.

Does LiteSpeed Cache work on any hosting?

No, it only works on servers running LiteSpeed Web Server or OpenLiteSpeed. If you are on Apache or Nginx, the plugin will not function.

Can I use LiteSpeed Cache with another caching plugin?

It is not recommended. Running multiple page caching plugins can cause conflicts and lead to issues like stale content or broken pages. If you use LSCache, disable other caching plugins.

How do I clear the cache in LiteSpeed Cache?

You can click the “Purge All” button in the WordPress admin toolbar or go to LiteSpeed Cache > Toolbox > Purge and select “Purge All.” You can also set up automatic purging when content is updated.

Does LiteSpeed Cache help with Core Web Vitals?

Yes, by reducing server response time and delivering cached pages faster, LSCache can improve metrics like Largest Contentful Paint (LCP) and Time to First Byte (TTFB), which are part of Google’s Core Web Vitals.