Surrogate Key Based Cache Purging
Before You Begin
You should be familiar with the concept of surrogate key based caching and purging.
See https://docs.fastly.com/en/guides/working-with-surrogate-keys for more information on working with surrogate keys.
This guide uses Drupal with the Pantheon Advanced Page Cache module installed.
How It Works
PantheonDrupalState class from our
package includes an adapted fetch method which adds the
to each request to Drupal. Responses from Drupal will contain the
Surrogate-Key header. With these keys, your frontend can be instructed to
purge content from a cache when the content in Drupal changes.
How To Ensure Headers Are Set On Custom Routes
- The Drupal backend has the Pantheon Advanced Page Cache module installed. installed and configured
- Create an instance of
@pantheon-systems/drupal-kitin your application.
- Use the fetch methods available (see
drupal-kitfor more information). The Surrogate-Key header should be set automatically if Drupal is configured correctly.
- Pass the
PantheonDrupalStatefetch method so that the headers are added to the outgoing response.