When using LSCache, you don't have to worry about your cache directory maintenance. LiteSpeed Web Server does all of this for you in a light and efficient way. Once your cache is fully warmed up, the cache directory size will not grow any further. When LSWS receives a purge request, it will simply mark the related cached objects as dirty. In order to avoid heavy disk operation, it does not delete the actual cache files on disk.
Then how does LSWS actually maintain the cache storage folder?
To answer that question, it's helpful to first define some terms:
Each cached object has a corresponding entry in the cache manager SHM. LSWS will check periodically (triggered by a timer) for expired cache entries based on the entries' defined TTLs. LSWS will select a list of entries based on LRU, and delete the related cache files on disk. Each time this happens, the batch size is small enough that it will not affect the whole server performance. The clean-up process is based on TTL only, it does not check for purge events.
When you press the Purge All button, you will not see the cache storage folder get emptied. You don't have to worry about the actual files on disk. LSWS takes care that for you constantly and quietly behind the scenes.
However, if you do want to remove the files yourself, you can delete your cache storage folder, or use our utility commands cleancache.sh
and cleanlitemage.sh
, which can be found under lsws/admin/misc/
.
Never try to create the cache storage folder manually. If it's missing, LSWS will create it for you, in the path you have defined, assigning the proper permissions.
NOTE: If you delete the cache manager SHM file, you will have to restart LSWS.
Learn more about cleancache.sh and cleanlitemage.sh.