mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Reduced memory consumption for pipelines
This commit is contained in:
+6
-6
@@ -400,21 +400,21 @@ class CommandPipeline {
|
||||
}
|
||||
|
||||
public function flushPipeline() {
|
||||
if (count($this->_pipelineBuffer) === 0) {
|
||||
$sizeofPipe = count($this->_pipelineBuffer);
|
||||
if ($sizeofPipe === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$connection = $this->_redisClient->getConnection();
|
||||
$commands = $this->getRecordedCommands();
|
||||
$commands = &$this->_pipelineBuffer;
|
||||
|
||||
foreach ($commands as $command) {
|
||||
$connection->writeCommand($command);
|
||||
}
|
||||
foreach ($commands as $command) {
|
||||
$this->_returnValues[] = $connection->readResponse($command);
|
||||
for ($i = 0; $i < $sizeofPipe; $i++) {
|
||||
$this->_returnValues[] = $connection->readResponse($commands[$i]);
|
||||
unset($commands[$i]);
|
||||
}
|
||||
|
||||
$this->_pipelineBuffer = array();
|
||||
}
|
||||
|
||||
private function setRunning($bool) {
|
||||
|
||||
Reference in New Issue
Block a user