Remove Connection\Aggregate\RedisCluster::setDefaultParameters().

The redis-cluster connection relies on a client-initialized connection factory,
so use Connection\Factory::setDefaultParameters() to set the default parameters
that must be applied to new nodes discovered through -MOVED or -ASK responses.
This commit is contained in:
Daniele Alessandri
2015-07-25 16:49:15 +02:00
parent 2b0c8fbb26
commit d69d6c726d
+1 -24
View File
@@ -45,7 +45,6 @@ use Predis\Response\ErrorInterface as ErrorResponseInterface;
class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
{
private $useClusterSlots = true;
private $defaultParameters = array();
private $pool = array();
private $slots = array();
private $slotsMap;
@@ -278,14 +277,10 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
{
$host = explode(':', $connectionID, 2);
$parameters = array_merge($this->defaultParameters, array(
return $this->connections->create(array(
'host' => $host[0],
'port' => $host[1],
));
$connection = $this->connections->create($parameters);
return $connection;
}
/**
@@ -532,22 +527,4 @@ class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
{
$this->useClusterSlots = (bool) $value;
}
/**
* Sets a default array of connection parameters to be applied when creating
* new connection instances on the fly when they are not part of the initial
* pool supplied upon cluster initialization.
*
* These parameters are not applied to connections added to the pool using
* the add() method.
*
* @param array $parameters Array of connection parameters.
*/
public function setDefaultParameters(array $parameters)
{
$this->defaultParameters = array_merge(
$this->defaultParameters,
$parameters ?: array()
);
}
}