Removes a connection instance by using its identifier.
public removeById ( string $connectionID ) : boolean | ||
$connectionID | string | Connection identifier. |
Результат | boolean | True if the connection was in the pool. |
/** * @group disconnected */ public function testRemovingConnectionsFromClusterByAlias() { $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); $this->assertTrue($cluster->removeById('127.0.0.1:6380')); $this->assertFalse($cluster->removeById('127.0.0.1:6390')); $this->assertSame(1, count($cluster)); }