Must Use Setup

Object Cache Pro can run as a MU plugin and may even be located outside the mu-plugins directory, when the WP_REDIS_DIR constant is used.

Using Composer

If the plugins is installed using Composer, a simple post-update-cmd script can that automatically configure the setup for you. The script below will copy the stub as well as the plugin directory to the mu-plugins directory after each Composer update.

composer.json
{
"scripts": {
"post-update-cmd": [
"cp wp-content/plugins/redis-cache-pro/stubs/mu-plugin.php wp-content/mu-plugins/redis-cache-pro.php",
"cp -r wp-content/plugins/redis-cache-pro wp-content/mu-plugins/"
]
},
}

Outside web root

In some cases, like shared environments or managed hosting, Object Cache Pro might needs to be located outside your web root directory. This can easily be accomplished the WP_REDIS_DIR constant and the mus-use stub.

First, define the constant near your WP_REDIS_CONFIG.

define('WP_REDIS_DIR', '/path/to/redis-cache-pro');
define('WP_REDIS_CONFIG', [
// ...
]);

Next, set up a Composer post-update-cmd script to install the plugin and copy the must-use stub:

composer.json
{
"scripts": {
"post-update-cmd": [
"cd /path/to/ && composer require tillkruss/redis-cache-pro",
"cp /path/to/redis-cache-pro/stubs/mu-plugin.php wp-content/mu-plugins/redis-cache-pro.php"
]
}
}

That's it.