LiteSpeed Cache for XenForo¶
This documentation is for LSCache for XenForo 2, for use only with XenForo 2.x. For XenForo 1.x, please visit our wiki.
What is LSCache?¶
LiteSpeed Cache (also called LSCache) is LiteSpeed's more efficient and highly customizable answer to Apache
mod_cache and Varnish.
LSCache is built from the ground up and integrated into all LiteSpeed server products. It can:
- dramatically speed up dynamic website content (like PHP pages)
- provide more efficient handling of static content (like images)
- reduce server load
If you are new to website caching, allow us to demystify a few basic concepts.
What is Caching?¶
Generally speaking, a cache is a mechanism for storing data in such a way that it is easier or faster to retrieve than the original source.
Web application sites consist of dynamic pages that are built with PHP or some other method. The pages of these sites don’t exist anywhere in the file system; they are constructed on-demand by the web app, and then served to the visitor as HTML. Generating these dynamic pages can be resource-intensive and slow.
There are actually several types of caches. LSCache is a "page cache." A page cache's job is to take this dynamically generated web page, and store it as a static HTML snapshot. That way, the next time the page is requested by a visitor, the snapshot can be served immediately. Serving a snapshot is much faster and uses far fewer resources than generating the page dynamically does.
How does LSCache Work?¶
Imagine you have an uncached page.
A visitor requests that page, and a few things happen:
- LiteSpeed looks for the page among its stored cache objects and does not find it
- LiteSpeed returns a "cache miss"
- The web app dynamically generates a static HTML page while the visitor waits
- LiteSpeed serves the static HTML page to the visitor
- LiteSpeed stores the static HTML page as a cache object for later use
A few minutes later, another visitor requests that same page. Here's what happens:
- LiteSpeed looks for the page among its stored cache objects and finds it
- LiteSpeed returns a "cache hit"
- LiteSpeed immediately serves the static HTML page to the visitor
Notice how the inefficient web app is not in the picture at all once the page has been cached? From this point on, until the cache object expires, any visitors who request that page will not have to wait around for the web app.
You can see why caching is good for your visitors, and good for your server load!
Why Use a Plugin?¶
The LiteSpeed Cache Engine can be controlled through rewrite rules in the .htaccess of a web app's document root. So what do you gain by using an LSCache plugin?
An LSCache plugin bridges the knowledge gap between a web app and the Cache Engine.
Put another way: web apps have rules about what content may be cached, for how long it may be cached, and what events would cause a cache object to become stale. LSCache plugins are a way of communicating these web app rules to the Cache Engine. LSCache plugins allow you to manage the cache in such a way that more objects may be stored for a longer period, and with unparallelled accuracy.
- LSCXF will only cache and serve pages for non-logged-in users. After a user has logged in, their page requests will always be freshly generated by XenForo.
- TTL in LSCXF2 is currently controlled by rewrite rules. At this time, there is no tag-based purge available. Because of this, it is recommended that you use a small TTL (less than 10 minutes, or 600 seconds). A small TTL minimizes the chances of serving stale content.
Obtain a LiteSpeed Web Server¶
You will either need LiteSpeed-powered hosting, or one of the following LiteSpeed server products in order to use LSCache:
- LiteSpeed Enterprise Web Server:
- LiteSpeed Web ADC
Configure the Server¶
LSCache must be set up at the server level before it can be made available to any sites on the server.
If you are a site owner and you don't have access to your server's admin functions, chances are your hosting provider has already done this setup for you, or can help you to complete it.
See Configure Cache Root and Cache Policy for instructions.
Install, Configure and Use the Plugin¶
Once you've set up your web server and configured the cache root and cache policies, you're ready to install the plugin. The plugin will allow you to configure and manage your LiteSpeed server's cache simply and easily, through your site's own familiar admin interface.
Start with Installation and follow the documentation menu to configure and use the plugin.
If you've read the documentation and still have questions, more help is available here:
- Join the GoLiteSpeed Slack community for real-time discussion
- Visit the LiteSpeed Forums for community support
- Submit a ticket from the client area or by emailing