Advanced Configuration Options for LSCache Storage and Policy Settings
Setting Cache Root to a RAM Disk
To use a per user cache directory in RAM, an absolute path must be specified, such as
CacheRoot /dev/shm/lscache/user1
Note1: Be careful not to use the same cache directory for two accounts as this is likely to cause trouble. Note2: There is not much benefit to setup cache root to RAM disk hence usually not recommended.
Setting Virtual Host Cache Root Using Variables
LiteSpeed Web Server supports variables in the Virtual Host cache root configuration when using an Apache configuration file. For example:
/dev/shm/lscache/$vh_name /dev/shm/lscache/$vh_domain /dev/shm/lscache/$vh_user
The variables are based on the virtual host configuration. For Apache VHosts, $vh_name is the same as $vh_domain which is the ServerName for that VHost.
Cache Policy Settings
You can fine tune your cache policy settings at the Server, Virtual Host, or Context level by logging into the LiteSpeed Web Server WebAdmin Console and navigating to
Server Level: Configuration > Server > Cache:
Virtual Host Level: Configuration > Virtual Hosts > [vh_name] > Cache:
Context Level: Configuration > Virtual Hosts > [vh_name] > Context > [context_name].
As our default settings work well with most caching scenarios, it is not common to have to change any of these settings.
NOTE: The Publicly Cache All and Private Cache All settings are not available at the server level, as it is strongly recommended that you not enable caching server-wide. If you have a need for global caching, you may configure a Context for that purpose.
Cache Manager files
LiteSpeed replies on file manager to manage caches. LiteSpeed uses .cachemanidx.lock
and .cachemanidx.shm
to manage caches.
There is no special configuration required from user's side but a knowledge only: by default, they will be set to RAM disk under /dev/shm/lsws/
. RAM disk can speed up the cache management.
For server level or virtual host level of cache root, normally store the actually cached files, SSD is good and recommended. You should NOT use any normal hard disk. SSD is a must for your site performance. While setup such cache storage to RAM disk is normally not necessary and not much benefit either, hence not recommended.