Knowledge base article

Introduction to LiteSpeed Cache

An introduction to LiteSpeed Cache and the basic cache types available

LiteSpeed Cache is a caching system inbuilt with the LiteSpeed web server which accelerates the performance of your application by generating cached versions of your website assets.

A cached version of a webpage is a static copy of the webpage which is saved as a file (or combination of files), after the cache file(s) has been generated, the file(s) can be served extremely fast to the next user. When caching is disabled, instead of serving a static file, the web server needs to process all the scripts loading on each page, which takes a lot more time and resources than serving a cached version of the webpage which can be instantaneous.

LiteSpeed cache is simple to configure using the free LiteSpeed Cache plugins available for most popular content management systems, such as WordPress, Magento, Craft, Joomla, Drupal. Visit the LiteSpeed documentation to check if there's a LiteSpeed Cache plugin available for your web application.

Within the LiteSpeed cache plugin, you can manage various caching rules which determine how caching works for your website, for example you can adjust how long cached versions of the page are stored, or what types of files or pages you would like included in the cache. There's also advance settings which allow you to optimise various website assets, such as compressing images, minifying HTML, JS and CSS and more!

LiteSpeed Cache uses rewrite directives in the .htaccess file to mange cache configurations, these directives are automatically written to your .htaccess file when you're using a LiteSpeed Cache plugin. If a LiteSpeed Cache plugin is not available for your application, you can configure LiteSpeed Cache manually using .htaccess rewrite directives, please reference LiteSpeed's no plugin setup guideline.

There are two primary cache types when using LiteSpeed Cache:

  1. Public Cache - Designed for publicly accessible website content which is not user specific. Public cache files can be served to any site visitor.
  2. Private Cache - Designed for user specific content. Private cache is used for areas which contain private information such as a website administrative area, contact forms, personalised greetings, checkouts and carts etc. Private cache is generated separately for each user (usually tracked by an IP address or session ID) so be mindful when identifying areas where private cache is required to ensure sensitive data is protected.

Cache storage

Our performance servers each have a partition dedicated to the storage of our clients public cache files, this reduces the disk usage overhead for our clients because publicly cached files are not included in their subscriptions disk usage consumption. As a security measure private cache files are stored within a users home directory. By default private cache files are stored under ~/lscache.

Our Business hosting servers also offer LiteSpeed Cache however all cache files are stored within the clients home directory.

ESI (Edge Side Includes)

LSCache also supports Edge Side Includes (ESI) which is a markup language enabling you to seperate a webpage into different cache types. This means you can use a combination of public and private cache on webpages. This great feature makes it possible to cache the majority of your web content.

Last updated November 30, 2023

Can't find what you're looking for?

Submit a question

  • Drop files here or
    Max. file size: 2 MB, Max. files: 3.
    • This field is for validation purposes and should be left unchanged.