On this page
Public cache vs. private cache
Understand when LiteSpeed Cache should use a public cache, a private cache, or no cache at all.
LiteSpeed Cache can serve responses from either a public (shared) cache or a private (per-user) cache. Knowing the difference helps you configure caching correctly for your site.
Public cache
A public cache is shared across all visitors. Because many users can receive the same cached response without the request ever reaching your origin server, public caching delivers the greatest performance and scalability gains.
Use a public cache for content that is:
- Infrequently changed
- Requested frequently by many different visitors
Private cache
A private cache is tied to a single user or client. It does not scale as broadly as a public cache, but it has important advantages for personalised or restricted content:
- It can cache representations that are only meaningful to one authenticated user.
- It can cache content that would be inappropriate for a shared cache to store or return without re-validation - for example, anything visible only to authorised users, or content whose representation changes depending on who is viewing it.
- Encrypted documents can technically be stored in a private cache, though this requires high confidence in the security of the cache itself and is not common practice.
Use a private cache for:
- Personal or account-specific information visible only to an authenticated user
- Resources restricted to authorised users
- Resources served over HTTPS
- Responses that set cookies
No cache
Some responses should not be cached at all:
- POST requests
- Dynamic content, such as time-sensitive data
- Frequently changing objects
When in doubt, err on the side of a more restrictive cache setting. Serving stale or incorrect personalised content to the wrong user is a harder problem to debug than a minor performance loss.