Must Use Setup
Object Cache Pro can run as a Must-Use Plugin and can even be located outside the
mu-plugins directory, when the
WP_REDIS_DIR constant is used.
Using Composer #
If the plugin is installed using Composer, a
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.
"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/"
Plugin Directory #
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 must-use stub.
First, define the constant near your
Next, set up a Composer
post-update-cmd script in your
composer.json to install the plugin and copy the must-use stub:
"cd /path/to/ && composer update",
"cp /path/to/redis-cache-pro/stubs/mu-plugin.php wp-content/mu-plugins/redis-cache-pro.php"