mirror of
https://github.com/predis/predis.git
synced 2026-09-05 15:42:31 +00:00
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:
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user