Commit a2edac75 authored by Erick Hitter's avatar Erick Hitter
Browse files

Allow default configuration to be overridden by constants in wp-config.php

Supports alternative Redis configurations without requiring hacks to the plugin file
parent 80f1df74
......@@ -782,7 +782,23 @@ class WP_Object_Cache {
public function __construct() {
require_once 'predis/autoload.php';
$this->redis = new Predis\Client( '' );
$redis = array(
'host' => '127.0.0.1',
'port' => 6379,
);
if ( defined( 'WP_REDIS_BACKEND_HOST' ) && WP_REDIS_BACKEND_HOST ) {
$redis['host'] = WP_REDIS_BACKEND_HOST;
}
if ( defined( 'WP_REDIS_BACKEND_PORT' ) && WP_REDIS_BACKEND_PORT ) {
$redis['port'] = WP_REDIS_BACKEND_PORT;
}
if ( defined( 'WP_REDIS_BACKEND_DB' ) && WP_REDIS_BACKEND_DB ) {
$redis['database'] = WP_REDIS_BACKEND_DB;
}
$this->redis = new Predis\Client( $redis );
unset( $redis );
global $blog_id, $table_prefix;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment