public function remove(NodeConnectionInterface $connection) { if (($id = array_search($connection, $this->pool, true)) !== false) { unset($this->pool[$id]); $this->distributor->remove($connection); return true; } return false; }
/** * @group disconnected */ public function testRemovingConnectionsFromCluster() { $connection1 = $this->getMockConnection(); $connection2 = $this->getMockConnection(); $connection3 = $this->getMockConnection(); $cluster = new PredisCluster(); $cluster->add($connection1); $cluster->add($connection2); $this->assertTrue($cluster->remove($connection1)); $this->assertFalse($cluster->remove($connection3)); $this->assertSame(1, count($cluster)); }