mirror of
https://github.com/predis/predis.git
synced 2026-09-16 21:36:58 +00:00
When using a ConnectionCluster (sharding data over multiple servers), disallow sending commands that cannot be hashed by a key argument.
This commit is contained in:
+6
-3
@@ -786,9 +786,12 @@ class ConnectionCluster implements IConnection, \IteratorAggregate {
|
||||
}
|
||||
|
||||
private function getConnection(Command $command) {
|
||||
return $command->canBeHashed()
|
||||
? $this->getConnectionFromRing($command)
|
||||
: $this->getConnectionById(0);
|
||||
if ($command->canBeHashed() === false) {
|
||||
throw new ClientException(
|
||||
sprintf("Cannot send '%s' commands to a cluster of connections.", $command->getCommandId())
|
||||
);
|
||||
}
|
||||
return $this->getConnectionFromRing($command);
|
||||
}
|
||||
|
||||
public function getConnectionById($id = null) {
|
||||
|
||||
Reference in New Issue
Block a user