Mark Jaquith Releases Cache Buddy: A Plugin to Enhance Popular WordPress Caching Solutions

photo credit: SergioMonsalve - cc
photo credit: SergioMonsalvecc

Mark Jaquith, one of the lead developers of WordPress, released Cache Buddy on WordPress.org over the weekend. His new plugin works alongside caching solutions, such as WP Super Cache, Batcache, and W3 Total Cache, to enable WordPress to better serve cached pages to logged-in users.

Jaquith knows just about everything there is to know about site optimization and caching techniques in WordPress. He recently gave a presentation at WordCamp London 2015, entitled “Cache Money Business” where he debuted the new plugin.

He introduced Cache Buddy as “a companion for your WordPress page caching solution.” Ordinarily, when WordPress is serving pages to logged-in users or those with comment cookies, it cannot cache pages, even with popular caching plugins in place. Cache Buddy steps in to fill in the gap, allowing WordPress to serve a cached page to logged-in users by performing the following:

  1. Changes what paths logged-in cookies are set for (so they work in the WordPress backend, but don’t exist on the front of the site).
  2. Sets custom cookies with relevant information about the logged-in user, on the front of the site, making these cookies JavaScript-readable.
  3. Sets custom cookies for commenters (again, JavaScript-readable), and doesn’t set the normal WordPress comment cookies.
  4. Uses the information from these JavaScript cookies, plus some comment form magic, to recreate the comment form experience users would get from a dynamic page.

By cutting down on the number of dynamic views (cache misses), the load on your sever is dramatically decreased. The toolbar will be hidden from Subscriber and Contributor users, but Authors, Editors, and Administrators will still see the toolbar and get dynamic views.

Cache Buddy is ideal for sites that already have a caching solution in place and get lots of traffic but have no strict requirements on providing dynamic views. Jaquith summarized the kinds of sites for which Cache Buddy will not be useful:

If you have a BuddyPress site or an e-commerce site, you may honestly need WordPress logged-in cookies available on the front of your site. But if you’re just running a blog/CMS site with a significant number of commenters and logged-in Subscribers, this plugin could massively speed up your site, because requests that had to always be dynamic before, can now be served from a page cache.

Cache Buddy is available to download for free from WordPress.org. To learn more about how it works, check out Jaquith’s post introducing the plugin, as well as his slides from WordCamp London 2015.

6

6 responses to “Mark Jaquith Releases Cache Buddy: A Plugin to Enhance Popular WordPress Caching Solutions”

  1. I ended up writing a half-baked hacky implementation of something like this recently. Thanks to Mark for writing something which (presumably) works properly :)

  2. Why would we use this over the default settings in W3TC which allow you to cache pages for logged in users and only do it for specific user types (Admin, Sub, etc)?

  3. That’s really awesome. Many thanks to Mark!

    It ought to be stressed — as Mark notes on his blog — the problem being solved with this plugin exists on managed WordPress hosting where server side caching is used. So this plugin will help you out there too.

    Seems like an ideal use case would be a multi-user content site where people involved in the publishing workflow are frequently logged in.

    • …or rather, a multi-user content-focused site whose staff is frequently logged in and writing/editing/moderating from the front end for a core group of readers who typically log in to WP as subscribers.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: