About the LiteSpeed Cache Storage Directory

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:

  • Cached Object: A cache entry stored in LSCache. A cached object maps to a URL plus an optional variation. For example, if one URL has a desktop view and a mobile view, there will be two cached objects for that URL: one for each of those views. It can be full page content or ESI block content.
  • Cache Manager SHM: Shared memory that cache manager uses to store all of the information about the cache entries. It is a memory-mapped file persistent to disk. You can point it to a RAM disk for faster access. Just keep in mind that the data on a RAM disk will be lost if your physical server reboots. (LSWS restart will not affect this.)
  • LRU: Least Recently Used cache replacement.

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.

  • Admin
  • Last modified: 2018/05/01 20:42
  • by Lisa Clarke