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:
Daniele Alessandri
2009-12-14 18:15:10 +01:00
parent 344ec44059
commit b1edc31af3
+6 -3
View File
@@ -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) {