mirror of
https://github.com/predis/predis.git
synced 2026-10-20 10:46:48 +00:00
Merge branch 'pullreq_18'
This commit is contained in:
+6
-4
@@ -93,6 +93,9 @@ class Client {
|
||||
}
|
||||
$this->setConnection($cluster);
|
||||
}
|
||||
else if ($parameters instanceof IConnectionCluster) {
|
||||
$this->setConnection($parameters);
|
||||
}
|
||||
else {
|
||||
$this->setConnection($this->createConnection($parameters));
|
||||
}
|
||||
@@ -721,10 +724,6 @@ class CommandPipeline {
|
||||
$this->_pipelineBuffer[] = $command;
|
||||
}
|
||||
|
||||
private function getRecordedCommands() {
|
||||
return $this->_pipelineBuffer;
|
||||
}
|
||||
|
||||
public function flushPipeline() {
|
||||
if (count($this->_pipelineBuffer) > 0) {
|
||||
$connection = $this->_redisClient->getConnection();
|
||||
@@ -1215,6 +1214,9 @@ interface IConnectionSingle extends IConnection {
|
||||
public function writeBytes($buffer);
|
||||
public function readBytes($length);
|
||||
public function readLine();
|
||||
public function getParameters();
|
||||
public function pushInitCommand(ICommand $command);
|
||||
public function __toString();
|
||||
}
|
||||
|
||||
interface IConnectionCluster extends IConnection {
|
||||
|
||||
@@ -408,8 +408,8 @@ class PredisClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$params3 = new \Predis\ConnectionParameters($params1);
|
||||
$params4 = new \Predis\TcpConnection($params3);
|
||||
|
||||
$client = new \Predis\Client(array($params1, $params2, $params3, $params4));
|
||||
foreach ($client->getConnection() as $connection) {
|
||||
$client1 = new \Predis\Client(array($params1, $params2, $params3, $params4));
|
||||
foreach ($client1->getConnection() as $connection) {
|
||||
$parameters = $connection->getParameters();
|
||||
$this->assertEquals($params1['host'], $parameters->host);
|
||||
$this->assertEquals($params1['port'], $parameters->port);
|
||||
@@ -417,6 +417,10 @@ class PredisClientFeaturesTestSuite extends PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals($params1['read_write_timeout'], $parameters->read_write_timeout);
|
||||
$this->assertNull($parameters->password);
|
||||
}
|
||||
|
||||
$connectionCluster = $client1->getConnection();
|
||||
$client2 = new \Predis\Client($connectionCluster);
|
||||
$this->assertSame($connectionCluster, $client2->getConnection());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user