Skip to main content
Last Reviewed: October 10, 2020


Caching strategies for improved performance.

This page includes information on how to improve optimization with caching.

Page Caching

Varnish is a web application accelerator that speeds up page delivery by caching contents to a configured HTTP server.

Pantheon's Global CDN

Reduce page rendering speeds from seconds to sub-seconds by caching content and resources alike across 40+ points of presence (POPs) on Pantheon's Global CDN.

Global CDN Map

Each POP caches all the resources (e.g., CSS and JavaScript) needed to render the page, including the HTML output. Using the closest physical POP to serve a request means the visitor doesn't have to wait as long to see the first meaningful paint (TTFP).

Full Page Caching

Pantheon is designed to store cached copies of the full HTML pages coming out of Drupal and WordPress core by default. If non-logged in visitors to your site are not getting a near-instant delivery of HTML from the cache in our Global CDN, something is wrong. Full page cache depends on the HTTP Headers coming out of your site.

Review Response Caching

The following describes the expected cache behavior for sites running the Pantheon Advanced Page Cache WordPress plugin or Drupal module. If you find that your page is not served from cache with similar headers and values, examine the response using Google's Developer tools and consult the next section for common cache busters and potential culprits.


The number of seconds cache has been available to serve the request. Any number greater than zero indicates that this response was served to the browser from cache.


This header should include a max-age that is the maximum number of seconds that the cache can be kept.


Metadata including the the content IDs for what was displayed on this page. This metadata instructs this page to be cleared from cache when any of those posts are saved again. This header is only present when you specifically add a debugging header (Pantheon-Debug:1) to your request. You can use a browser extension to add the debugging header. Here are some extensions for Chrome and Firefox.


This header indicates which POP your response came from. Our primary infrastructure is in the Midwest of the United States so the first item you will probably see on this list will include "ORD" for the O'Hare airport in Chicago. If you're physically located in Austin you will also see DFW, indicating the response went from the primary datacenter to a cached copy in Chicago to a cached copy in Dallas.

Chrome network headers

Google's Developer Tools

Examine the HTTP headers for the response using Chrome's Developer tools:

Check headers in chrome

  1. Right click somewhere on the page.

  2. Select Inspect.

  3. Open the Network tab, then refresh the page. This allows you to review all of the HTTP requests necessary to display your page.

  4. Select the first row, which is a request for the initial HTML file.

  5. Look for the Age header. Any number greater than zero indicates that this response was served to the browser from cache.

Troubleshoot Caching Issues


Cookies are included in the response headers we examined previously. They can include sessions for authenticated traffic to logged in users, which can invalidate cache. For WordPress, it's common for plugins to add their own cookies in such a way that breaks full-page caching.

For reference, here are all the cookie patterns configured to bust cache across Pantheon's Global CDN:

bp_completed_create_steps # BuddyPress cookie used when creating groups
bp_new_group_id # BuddyPress cookie used when creating groups

You can see the cookies used on your site under the Application tab in Chrome's Developer Tools.

Unintentional Cache Invalidation

Walk yourself through the content rendering tree, considering any custom or contrib code that may be affecting the directives set in the HTTP headers of a response.

There could be an existing snippet assumed to disable caching for a single entity when in reality it's disabling caching for the entire page:

* This is an example of accidentally bypassing cache when rendering a response.
* Don't use this without proper conditionals wrapped around the header function.
add_action( 'send_headers', 'add_header_maxage' );
function add_header_maxage() {
  // some logic that accidentally invalidates full-page cache
    header('Cache Control: max-age=0');

Visit the WordPress documentation for more details.

Incorrect Configuration

Working across many environments presents opportunities for configuration changes to get lost or for configurations to never be set correctly in the first place. Using tools like WP-CFM and Drupal 8's Configuration Management System to track configuration alongside code will mitigate these issues, but mistakes do happen. Double-check your site's default caching configurations:

The Pantheon Page Cache plugin is already included by our upstream as a Must-Use plugin. Check the plugin settings to make sure you're setting the desired TTL:

  1. From the WordPress dashboard, click Settings > Pantheon Page Cache.

  2. Review the Time to Live, which translates to max-age.

  3. We recommend setting Default Time to Live (TTL) to a higher value, like 86400 seconds (one day):

    Pantheon Cache Plugin

Optimize Non-Cached

Improve performance on longer trips to and from the browser for instances you want to bypass cache and go straight to the application.

Upgrade Your Site's PHP

Upgrade your site's PHP version to improve the security, performance, and supportability of your site.

See our blog post for an example of 62% performance gains after upgrading.

Enable Object Caching

Sites loading a lot of content can benefit from Object Caching. For more details, see also:

Enable OPcache

OPcache is a caching engine built into PHP. OPcache can improve PHP performance by storing precompiled script bytecode in shared memory. OPcache improves speed in modern PHP applications and is always enabled on Pantheon; however, many users disable the feature for security reasons when working in shared hosting environments.

OPcache is a transparent resource, and for most, simply turning it on will improve your site's performance. Object caching is another back-end optimization resource that can greatly improve the performance of your site.