public remove ( Predis\Connection\NodeConnectionInterface $connection ) | ||
$connection | Predis\Connection\NodeConnectionInterface |
/** * @group disconnected */ public function testRemovingConnectionResetsSlotsMap() { $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379'); $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380'); $cluster = new RedisCluster(new Connection\Factory()); $cluster->add($connection1); $cluster->add($connection2); $cluster->setSlots(0, 2047, '127.0.0.1:6379'); $cluster->setSlots(2048, 4095, '127.0.0.1:6380'); $expectedMap = array_merge(array_fill(0, 2048, '127.0.0.1:6379'), array_fill(2048, 2048, '127.0.0.1:6380')); $this->assertSame($expectedMap, $cluster->getSlotsMap()); $cluster->remove($connection1); $this->assertEmpty($cluster->getSlotsMap()); }