Using Redis for WordPress Object-Cache

Redis Installation

Add repo which maintains latest redis

add-apt-repository ppa:chris-lea/redis-server

Install redis-server and php-binding

apt-get update
apt-get install redis-server php5-redis

WordPress Object Cache

We are using this object-cache plugin – https://github.com/alleyinteractive/wp-redis

cd /var/www/example.com/htdocs/wp-content
wget https://raw.githubusercontent.com/alleyinteractive/wp-redis/master/object-cache.php
chown www-data: object-cache.php

WordPress Cache Salt/Prefix

Useful if you have multiple WordPress.

Inside wp-config.php

define('WP_CACHE', true);
define('WP_CACHE_KEY_SALT', 'example.com/subdir');

Related: https://rtcamp.com/tutorials/php/redis-php-sessions/