OpenLiteSpeed Caching Guide
Caching on OpenLiteSpeed
OpenLiteSpeed has a built-in page caching engine called LSCache. Combined with the LiteSpeed Cache WordPress plugin, it delivers performance comparable to Varnish without the complexity. BlitzPress uses LSCache as its primary caching layer.
How LSCache Works
LSCache stores fully rendered HTML pages in OLS’s shared memory. When a visitor requests a page, OLS serves the cached copy directly without executing any PHP. This is a server-level cache — far faster than PHP-based caching plugins like WP Super Cache.
Cache Types
| Cache Type | What It Caches | Configuration |
|---|---|---|
| Public Cache | Pages visible to all visitors | Default for non-logged-in users |
| Private Cache | Per-user content (e.g., WooCommerce cart) | Enabled via ESI or Vary cookie |
| Browser Cache | Static assets (CSS, JS, images) | Cache-Control headers |
| OPcache | Compiled PHP bytecode | PHP extension |
| Redis Object Cache | Database query results | wp-config.php + plugin |
Cache TTL Configuration
In the LiteSpeed Cache plugin, go to Cache > TTL:
- Default Public Cache TTL: 604800 (7 days) — pages rarely change
- Default Front Page TTL: 604800
- Feed TTL: 0 (do not cache RSS feeds)
- 404 TTL: 3600 (1 hour)
Edge Side Includes (ESI)
ESI lets you cache a page publicly but exclude dynamic fragments (like a shopping cart widget). The cached page has an ESI tag that OLS replaces with fresh content per-request. Enable ESI in LiteSpeed Cache > ESI.
Purging the Cache
LSCache auto-purges on content changes (post publish, comment, etc.). To manually purge:
- From WordPress: LiteSpeed Cache toolbar > Purge All
- Via CLI:
sudo wp litespeed-purge all --path=/home/DOMAIN/public_html --allow-root - From shell:
sudo rm -rf /tmp/lscache/DOMAIN/
Verifying Cache Hits
curl -I https://YOUR_DOMAIN/ 2>/dev/null | grep -i x-litespeed
# X-LiteSpeed-Cache: hit (cached)
# X-LiteSpeed-Cache: miss (not cached)