Commit dd109e89 authored by Eric Mann's avatar Eric Mann
Browse files

Merge pull request #11 from hans2103/patch-3

added authentication to connect with Redis
parents 7b2d176a d532386f
......@@ -320,6 +320,9 @@ class WP_Object_Cache {
if ( defined( 'WP_REDIS_BACKEND_PORT' ) && WP_REDIS_BACKEND_PORT ) {
$redis['port'] = WP_REDIS_BACKEND_PORT;
}
if ( defined( 'WP_REDIS_BACKEND_AUTH' ) && WP_REDIS_BACKEND_AUTH ) {
$redis['auth'] = WP_REDIS_BACKEND_AUTH;
}
if ( defined( 'WP_REDIS_BACKEND_DB' ) && WP_REDIS_BACKEND_DB ) {
$redis['database'] = WP_REDIS_BACKEND_DB;
}
......@@ -329,6 +332,10 @@ class WP_Object_Cache {
try {
$this->redis = new Redis();
$this->redis->connect( $redis['host'], $redis['port'] );
if ( isset( $redis['auth'] ) ) {
$this->redis->auth( $redis['auth'] );
}
if ( isset( $redis['database'] ) ) {
$this->redis->select( $redis['database'] );
......
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