Download the PHP package acpl/flarum-lscache without Composer
On this page you can find all versions of the php package acpl/flarum-lscache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package flarum-lscache
โก LiteSpeed Cache for Flarum
Full-page LiteSpeed caching for Flarum.
If your forum runs on LiteSpeed, this is a must-have for heavy guest and bot traffic. The first request generates a response; LiteSpeed serves later requests for the same cached page directly, without running PHP or querying the database again. This can substantially reduce server load.
Requires LiteSpeed Web Server or OpenLiteSpeed with LSCache enabled.
๐ฅ Installation
Install with Composer:
Back up your .htaccess before enabling the extension. It adds its cache rules to that file on activation.
๐ Updating
๐งน Cache Management
Changes invalidate the affected cache entries. For example, a new public post clears the cache for its discussion, tag pages, and the homepage.
Clearing Flarum's cache also clears LSCache, unless you disable this in the extension settings.
To clear only LSCache, use the admin panel's cache menu or the CLI:
โ FAQ
Does it cache pages for logged-in users?
No. Forum pages are cached for guests only. Logged-in users can see different content, permissions, notifications, and read states. Sharing their cached pages would be unsafe.
A separate cache for each user would still need to generate each page on that user's first visit, then rebuild it whenever their content changes. That means fewer cache hits and more invalidation work. Guest caching lets many visitors reuse the same response.
Does it work on Apache or nginx?
No. It requires the LSCache engine in LiteSpeed Web Server or OpenLiteSpeed.
๐ง๐ปโ๐ป For Developers
[!NOTE] Cache tags are labels used to invalidate cached responses. They are separate from the discussion tags provided by
flarum/tags.
๐ท๏ธ How the Extension Tags Paths
Cache tags come from route names. For example, an extension could register these API routes:
For GET and HEAD responses:
.indexroutes get the resource tag:examples.indexโexamples.- Other routes get their full name:
examples.showโexamples.show. - An
idorslugroute parameter adds a tag using the singular resource name:example_1orexample_example-slug.
[!TIP] To see the cache tags added for a given request, check the value of the
X-LiteSpeed-Tagheader in the Network tab of DevTools.
๐๏ธ Purging Cache
Successful POST, PUT, PATCH, and DELETE requests to .create, .update, or .delete routes purge the resource's ID tag when an id route parameter is present. A collection's .create route usually has no id, so use events to invalidate its list cache.
For event-based purging, register the singular resource name in $resourcesSupportedByEvent to disable automatic ID purging. Keep this registration inside the condition so your extension also works when LSCache is disabled or absent:
[!TIP] Prefer tags: they also invalidate cached URL variants, including query strings.
For one tag, use addPurgeTag('examples'). To purge URLs directly, use addPurgePath('/api/examples') or addPurgePaths(['/api/examples', '/api/examples/1']).
To handle multiple events in one class, use a subscriber instead: