WpW: Private Cache vs. Public Cache
Welcome to another installment of WordPress Wednesday!
Did you know that the LiteSpeed Cache plugin for WordPress supports private cache? Today we’re going to talk about the difference between public and private cache, and what this means for your WordPress blog.
Private Cache vs. Public Cache
Public cache is cache that can be accessed by everyone. A single copy of a publicly-cached page is stored and served to everyone who requests it.
Private cache is only accessible to an individual visitor. It usually contains information that is only pertinent to that particular user (for instance, the WordPress admin bar). When a page is privately-cached, there is a separate personalized copy stored for each user that requests it.
Many other cache plugins only deal in public cache, and so any page that has individualized data on it, is just not cached at all. When a user is logged in, there is the potential for every page to have private data on it, and so other plugins deal with this by never caching anything for logged-in users.
LiteSpeed supports private cache, which means that many of the pages that other plugins consider uncacheable are actually cached easily by LiteSpeed.
Is this the same thing as ESI?
No, though Private Cache is an essential element of ESI. ESI (Edge Side Includes) technology allows you to disassemble a page, pull some parts of it from public cache, and other parts of it from private cache, re-assemble the page, and serve it to the visitor. If you want to know more about how ESI works, there’s a WordPress Wednesday for that.
NOTE: OpenLiteSpeed doesn’t support ESI, but it does support Private Cache.
So, how does our Private Cache work?
There are two situations in which you have the ability to enable Private Cache: when a user is logged in, or when a visitor has pending comments. You can enable or disable this functionality in WP-Admin. Navigate to LiteSpeed Cache > Cache and select the Cache tab.
When Cache Logged in User is set to
ON, LSCWP will privately cache every page for logged-in users. Each logged-in user will have their own individual copy of every cacheable page they visit.
When set to
OFF, no pages will be cached at all for logged-in users.
When Cache Commenter is set to
ON, LSCWP will cache pages for users who have left a pending comment. This setting is relevant for sites where comment moderation is enabled. Visitors who have left a comment that is awaiting moderation are able to see their comment, even though nobody else is able to do so. This makes their view different than everyone else and therefore ineligible to be served from public cache.
When set to
OFF, no pages will be cached at all for visitors who have left a pending comment.
If you have pages that should always be cached privately (and never publicly), you can list them in Private Cached URIs, further down on that same page.
List the URIs one per line. (The URI is the part of the URL that comes after
Press the Save Changes button after editing any of the settings on this page.
We’ve got more enhancements to come! In the meantime, we hope you’ll share your feedback and let us know how we’re doing! And of course, if you find any of this confusing, don’t hesitate to reach out and ask us about it. That’s what we’re here for.
Also! If you are a fan of our plugin, would you mind leaving us a rating or review in the WP Plugin directory if you haven’t already? Every little bit of word-of-mouth helps! Thanks 🙂
This content was last verified and updated in June of 2022. If you find an inaccuracy, please let us know! In the meantime, see our documentation site for the most up-to-date information.
Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!
Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:
- Subscribe to the WordPress Wednesday RSS feed
- Download LiteSpeed Cache for WordPress plugin
- Learn more about the plugin on our website