Expose the command hash strategy from the predis cluster class.

This will be useful to add, remove or change the handler used to
extract, validate and hash the keys of each command instance.
This commit is contained in:
Daniele Alessandri
2012-07-25 21:25:50 +02:00
parent c3cafaa9a6
commit f2d92f1e29
2 changed files with 20 additions and 0 deletions
+11
View File
@@ -167,6 +167,17 @@ class PredisCluster implements ClusterConnectionInterface, \IteratorAggregate, \
return $node;
}
/**
* Returns the underlying command hash strategy used to hash
* commands by their keys.
*
* @return CommandHashStrategy
*/
public function getCommandHashStrategy()
{
return $this->cmdHasher;
}
/**
* {@inheritdoc}
*/
@@ -21,6 +21,15 @@ use Predis\Profile\ServerProfile;
*/
class PredisClusterTest extends StandardTestCase
{
/**
* @group disconnected
*/
public function testExposesCommandHashStrategy()
{
$cluster = new PredisCluster();
$this->assertInstanceOf('Predis\Command\Hash\CommandHashStrategy', $cluster->getCommandHashStrategy());
}
/**
* @group disconnected
*/