Skip to content
Snippets Groups Projects
Commit 453f58d6 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher
Browse files

Revert "Issue #2882796 by Dave Reid, anish.a, jmullikin: Add support for...

Revert "Issue #2882796 by Dave Reid, anish.a, jmullikin: Add support for persistent connections to redis host"

This reverts commit 1576054e.
parent 3b8354f3
No related branches found
No related tags found
No related merge requests found
......@@ -141,13 +141,6 @@ If your Redis instance is remote, you can use this syntax:
Port is optional, default is 6379 (default Redis port).
Use persistent connections
--------------------------
This mode needs the following setting:
$settings['redis.connection']['persistent'] = TRUE;
Using a specific database
-------------------------
......
......@@ -14,7 +14,7 @@ class PhpRedis implements ClientInterface {
/**
* {@inheritdoc}
*/
public function getClient($host = NULL, $port = NULL, $base = NULL, $password = NULL, $persistent = FALSE) {
public function getClient($host = NULL, $port = NULL, $base = NULL, $password = NULL) {
$client = new \Redis();
// Sentinel mode, get the real master.
......@@ -25,12 +25,7 @@ class PhpRedis implements ClientInterface {
}
}
if ($persistent) {
$client->pconnect($host, $port);
}
else {
$client->connect($host, $port);
}
$client->connect($host, $port);
if (isset($password)) {
$client->auth($password);
......
......@@ -11,13 +11,12 @@ use Predis\Client;
*/
class Predis implements ClientInterface {
public function getClient($host = NULL, $port = NULL, $base = NULL, $password = NULL, $replicationHosts = NULL, $persistent = FALSE) {
public function getClient($host = NULL, $port = NULL, $base = NULL, $password = NULL, $replicationHosts = NULL) {
$connectionInfo = [
'password' => $password,
'host' => $host,
'port' => $port,
'database' => $base,
'persistent' => $persistent
'database' => $base
];
foreach ($connectionInfo as $key => $value) {
......@@ -37,15 +36,13 @@ class Predis implements ClientInterface {
$parameters = [];
foreach ($replicationHosts as $replicationHost) {
$param = 'tcp://' . $replicationHost['host'] . ':' . $replicationHost['port']
. '?persistent=' . (($persistent) ? 'true' : 'false');
// Configure master.
if ($replicationHost['role'] === 'primary') {
$param .= '&alias=master';
$parameters[] = 'tcp://' . $replicationHost['host'] . ':' . $replicationHost['port'] . '?alias=master';
}
else {
$parameters[] = 'tcp://' . $replicationHost['host'] . ':' . $replicationHost['port'];
}
$parameters[] = $param;
}
$options = ['replication' => true];
......
......@@ -150,7 +150,6 @@ class ClientFactory {
'port' => self::REDIS_DEFAULT_PORT,
'base' => self::REDIS_DEFAULT_BASE,
'password' => self::REDIS_DEFAULT_PASSWORD,
'persistent' => FALSE,
];
// If using replication, lets create the client appropriately.
......@@ -166,16 +165,14 @@ class ClientFactory {
$settings['port'],
$settings['base'],
$settings['password'],
$settings['replication.host'],
$settings['persistent']);
$settings['replication.host']);
}
else {
self::$_client = self::getClientInterface()->getClient(
$settings['host'],
$settings['port'],
$settings['base'],
$settings['password'],
$settings['persistent']);
$settings['password']);
}
}
......
......@@ -12,7 +12,7 @@ interface ClientInterface {
* @return mixed
* Real client depends from the library behind.
*/
public function getClient($host = NULL, $port = NULL, $base = NULL, $password = NULL, $persistent = FALSE);
public function getClient($host = NULL, $port = NULL, $base = NULL);
/**
* Get underlaying library name used.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment