mirror of
https://github.com/predis/predis.git
synced 2026-09-17 13:57:33 +00:00
Improved the internals of MultiExecBlock::execute (slight reduction in memory usage; check for out-of-sync conditions between the client and the server)
This commit is contained in:
+12
-2
@@ -495,9 +495,19 @@ class MultiExecBlock {
|
||||
if ($block !== null) {
|
||||
$block($this);
|
||||
}
|
||||
|
||||
$execReply = $this->_redisClient->exec();
|
||||
for ($i = 0; $i < count($execReply); $i++) {
|
||||
$returnValues[] = $this->_commands[$i]->parseResponse($execReply[$i]);
|
||||
$commands = &$this->_commands;
|
||||
$sizeofReplies = count($execReply);
|
||||
|
||||
if ($sizeofReplies !== count($commands)) {
|
||||
// TODO: think of a better exception message
|
||||
throw new ClientException("Out-of-sync");
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $sizeofReplies; $i++) {
|
||||
$returnValues[] = $commands[$i]->parseResponse($execReply[$i]);
|
||||
unset($commands[$i]);
|
||||
}
|
||||
}
|
||||
catch (\Exception $exception) {
|
||||
|
||||
Reference in New Issue
Block a user