Yesterday marked the release of WordPress 4.7, and we'll roll it out to Pantheon users tomorrow. Why? Because we’re putting the finishing touches on a new plugin, Pantheon Advanced Page Cache, which automatically clears related pages from Pantheon’s edge cache when you update content.
Even with a high default Time to Live (TTL), your visitors will never have to wait for fresh content. Coupled with WordPress 4.7’s REST-API, this new plugin will be a great addition to your toolbox for building scalable and performant sites.
Another Reason to Upgrade to 4.7
With the Pantheon Advanced Page Cache plugin enabled, you can take your site’s TTL from the default 10 minutes (600 seconds) to as high as 1 day (86400 seconds). This increases the chances that a visitor will receive a cached response, resulting in faster page load times.
Starting tomorrow, apply the 4.7 update on your Pantheon dashboard and then head over to your WordPress site’s admin panel. Visit Settings>Pantheon Page Cache and you’ll find a link to install Pantheon Advanced Page Cache.
For more information on considerations when upgrading existing sites on Pantheon to 4.7, see our documentation.
How It Works
The plugin leverages a technology called Surrogate Keys, which are a way to “tag” an arbitrary group of pages so they can be cleared as a group. For example, a home page response might include the Surrogate-Key header with the following keys:
HTTP/1.1 200 OK
Surrogate-Key: front home post-43 user-4 post-41 post-9
Then if post-9 were updated, the cache for both post-9 and the homepage would be automatically cleared by the plugin, but if a post not on the homepage were updated, the homepage’s cache would not be cleared.
Let’s say you have three (or three thousand!) posts on your WordPress site. If you update one of those posts, you don’t want to wait for your TTL to expire or clear the entire site’s cache. The former means visitors must wait for the cache to expire to see the updated content, while the latter blows away your entire cache resulting in slower page load times as the cache warms up. When responses are served directly from WordPress, they are much slower than when they are served from Pantheon’s edge. Here’s a more in-depth overview of the benefits of page caching.
For more specifics on the plugin’s default behavior, as well as functions you can use to customize your caching strategy, check out the plugin’s README.