mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
Add method to get connection factory from redis-cluster connection.
This commit is contained in:
@@ -497,6 +497,17 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
|
||||
return $this->strategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying connection factory used to create new connection
|
||||
* instances to Redis nodes indicated by redis-cluster.
|
||||
*
|
||||
* @return FactoryInterface
|
||||
*/
|
||||
public function getConnectionFactory()
|
||||
{
|
||||
return $this->connections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables automatic fetching of the current slots map from one of the nodes
|
||||
* using the CLUSTER NODES command. This option is disabled by default but
|
||||
|
||||
@@ -22,6 +22,17 @@ use Predis\Response;
|
||||
*/
|
||||
class RedisClusterTest extends PredisTestCase
|
||||
{
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testAcceptsCustomConnectionFactory()
|
||||
{
|
||||
$factory = $this->getMock('Predis\Connection\FactoryInterface');
|
||||
$cluster = new RedisCluster($factory);
|
||||
|
||||
$this->assertSame($factory, $cluster->getConnectionFactory());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user