diff --git a/object-cache.php b/object-cache.php index e84beef..90d6439 100644 --- a/object-cache.php +++ b/object-cache.php @@ -7,6 +7,13 @@ * can use this to guarantee uniqueness for the keys generated by this object cache. */ +if ( ! defined( 'WP_REDIS_USE_RELAY' ) ) { + define( 'WP_REDIS_USE_RELAY', false ); +} + +// Conditionally run the script if: the correct class exists, and the script has not been disabled. +if ( class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) && ( ! defined( 'WP_REDIS_DISABLED' ) || ! WP_REDIS_DISABLED ) ): + if ( ! defined( 'WP_CACHE_KEY_SALT' ) ) { define( 'WP_CACHE_KEY_SALT', '' ); } @@ -1293,7 +1300,7 @@ public function build_client_parameters( $redis_server ) { * @return Redis Redis client. */ public function prepare_client_connection( $client_parameters ) { - if ( defined( 'WP_REDIS_USE_RELAY' ) && WP_REDIS_USE_RELAY ) { + if ( WP_REDIS_USE_RELAY ) { $redis = new Relay\Relay(); } else { $redis = new Redis();