瀏覽代碼

Remove executeCommandOnNodes() from predis cluster backend.

It is still possible to achieve the same simply by iterating over the
connection or, even better, over the client instance.
Daniele Alessandri 8 年之前
父節點
當前提交
c10479e238
共有 3 個文件被更改,包括 5 次插入44 次删除
  1. 5 0
      CHANGELOG.md
  2. 0 18
      src/Connection/Cluster/PredisCluster.php
  3. 0 26
      tests/Predis/Connection/Cluster/PredisClusterTest.php

+ 5 - 0
CHANGELOG.md

@@ -52,6 +52,11 @@ v2.0.0 (201x-xx-xx)
   part of `Predis\Connection\Replication\ReplicationInterface` while the method
   `switchTo($connection)` has been removed from it.
 
+- The method `Predis\Connection\Cluster\PredisCluster::executeCommandOnNodes()`
+  has been removed as it is possible to achieve the same by iterating over the
+  connection or, even better, over the client instance in order to execute the
+  same command against all of the registered connections.
+
 
 v1.1.0 (2016-06-02)
 ================================================================================

+ 0 - 18
src/Connection/Cluster/PredisCluster.php

@@ -214,22 +214,4 @@ class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
     {
         return $this->getConnection($command)->executeCommand($command);
     }
-
-    /**
-     * Executes the specified Redis command on all the nodes of a cluster.
-     *
-     * @param CommandInterface $command A Redis command.
-     *
-     * @return array
-     */
-    public function executeCommandOnNodes(CommandInterface $command)
-    {
-        $responses = array();
-
-        foreach ($this->pool as $connection) {
-            $responses[] = $connection->executeCommand($command);
-        }
-
-        return $responses;
-    }
 }

+ 0 - 26
tests/Predis/Connection/Cluster/PredisClusterTest.php

@@ -351,32 +351,6 @@ class PredisClusterTest extends PredisTestCase
         $cluster->executeCommand($command);
     }
 
-    /**
-     * @group disconnected
-     */
-    public function testExecuteCommandOnEachNode()
-    {
-        $ping = $this->getCommandFactory()->createCommand('ping', array());
-
-        $connection1 = $this->getMock('Predis\Connection\NodeConnectionInterface');
-        $connection1->expects($this->once())
-                    ->method('executeCommand')
-                    ->with($ping)
-                    ->will($this->returnValue(true));
-
-        $connection2 = $this->getMock('Predis\Connection\NodeConnectionInterface');
-        $connection2->expects($this->once())
-                    ->method('executeCommand')
-                    ->with($ping)
-                    ->will($this->returnValue(false));
-
-        $cluster = new PredisCluster();
-        $cluster->add($connection1);
-        $cluster->add($connection2);
-
-        $this->assertSame(array(true, false), $cluster->executeCommandOnNodes($ping));
-    }
-
     /**
      * @group disconnected
      */