Parcourir la source

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.
Daniele Alessandri il y a 9 ans
Parent
commit
d69d6c726d
1 fichiers modifiés avec 1 ajouts et 24 suppressions
  1. 1 24
      src/Connection/Aggregate/RedisCluster.php

+ 1 - 24
src/Connection/Aggregate/RedisCluster.php

@@ -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()
-        );
-    }
 }