Enable Object caching on Test and Live

Redis is an open-source, in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.

Follow these steps to activate Redis on Test and Live environment on your Pantheon hosting:

1. Enable Redis from your Pantheon Site Dashboard by going to Settings > Add Ons > Add.

2. Install the WP Redis plugin via SFTP or Git. To install via Terminusset the connection mode to SFTP then run:

terminus wp <site>.<env> -- plugin install wp-redis

For site networks, you will need to specify the site URL by adding that to the command:

terminus wp <site>.<env> -- plugin install wp-redis --url=<url>

3. Create object-cache.php inside /wp-content/ folder containing:


if ( isset( $_SERVER['PANTHEON_ENVIRONMENT'] ) && in_array( $_SERVER['PANTHEON_ENVIRONMENT'], [ 'test', 'live' ] ) && file_exists( WP_CONTENT_DIR . '/plugins/wp-redis/object-cache.php' ) ) {
    require_once WP_CONTENT_DIR . '/plugins/wp-redis/object-cache.php';

To understand how to use Redis as a caching mechanism for your Pantheon site, please visit this link.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.