Skip to content

Commit

Permalink
Merge pull request #273 from timnolte/feature/set-connection-database
Browse files Browse the repository at this point in the history
Add Redis Database Number Support
  • Loading branch information
danielbachhuber committed Apr 14, 2020
2 parents 73b63db + f5a6b11 commit 8a367ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
14 changes: 8 additions & 6 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ public function cli() {
# Attempt to automatically load Pantheon's Redis config from the env.
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
$redis_server = array(
'host' => '127.0.0.1',
'port' => 6379,
'auth' => '',
'host' => '127.0.0.1',
'port' => 6379,
'auth' => '',
'database' => 0,
);
}
}
Expand Down
12 changes: 7 additions & 5 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1066,14 +1066,16 @@ public function build_client_parameters( $redis_server ) {
// Attempt to automatically load Pantheon's Redis config from the env.
if ( isset( $_SERVER['CACHE_HOST'] ) ) {
$redis_server = array(
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'host' => $_SERVER['CACHE_HOST'],
'port' => $_SERVER['CACHE_PORT'],
'auth' => $_SERVER['CACHE_PASSWORD'],
'database' => isset( $_SERVER['CACHE_DB'] ) ? $_SERVER['CACHE_DB'] : 0,
);
} else {
$redis_server = array(
'host' => '127.0.0.1',
'port' => 6379,
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
);
}
}
Expand Down

0 comments on commit 8a367ea

Please sign in to comment.