WordPress on Kubernetes

The Definitive Guide to WordPress on k8s

Page Caching with Redis

In the previous section we’ve configured a WordPress plugin to persistently store its object cache in a Redis database. This allows us to access certain WordPress data significantly faster.

In this section we’ll continue building on that, and add full page caching support to our WordPress application. This will serve entire HTTP requests from our centralized Redis database, without having to execute any of the underlying WordPress code apart from the bootstrapping process.

Note: all code samples from this section are available on GitHub.

Meet advanced-cache.php

We’ve already hinted at advanced-cache.php in an earlier section in this tutorial. This is a drop-in file that loads very early in the WordPress bootstrap process, before any themes or plugins are loaded, even before most of the remaining of WordPress core is loaded.

This drop-in is the perfect place to serve a cached response if we have one, and most WordPress-based page caching plugins will operate around this special file.

This article is for premium members only. Memberships start from $95/year and unlock access to all existing and future content on kubeadm.org, including all reference architectures.

Already a member? Login here