Caching recommendations

Squiz has enabled stale-while-revalidate (SWR) support in the Squiz Cloudflare workers.

This support allows for a recommended caching strategy to be implemented.

Recommend caching strategy

The strategy is summarized in these broad points:

  • Configure a relatively low maximum age HTTP header.

  • Configure a relatively high SWR HTTP header.

  • Configure Squiz Content Management to:

    • Send headers that indicate the content is cacheable.

    • NOT clear the cache when content is updated.

    • Disable cache-clearing triggers.

      Cache-clearing triggers are unnecessary for this particular caching strategy.

Caching strategy outcomes

The outcome of this is:

  • Changes to popular content appear to public users approximately three minutes after the change is published.

  • New content is available immediately after publishing.

  • A page that is not frequently accessed (for example, an outdated news article) remains in the cache for the SWR duration (recommended 24 hours).

    This outcome is true even if a page is not requested again during that period.
  • A frequently accessed page is re-cached up to 480 times per day ((24*60*60)/180), even if content editors do not update the page.

  • Backend performance improves because fewer cache-clearing triggers are firing on page edits.

Caveats

This caching strategy does not apply to File assets with the Allow unrestricted access option enabled. For example, File assets served directly from the server with a /__data path in the URL.

Public files with unrestricted access are also not subject to the recommended cache configuration within Squiz Content Management. For this reason, you should review files like this across your system and consider denying unrestricted access to allow appropriate cache configuration to apply.