diff --git a/CHANGELOG.md b/CHANGELOG.md index b8931a78a..d95d56484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 redis extension Change Log 2.0.19 under development ------------------------ -- no changes in this release. +- Enh #264: Improve performance of `mget()` for big list of keys (alx-xc, rob006) 2.0.18 September 04, 2022 diff --git a/src/Connection.php b/src/Connection.php index fd8e63c13..b9772ff25 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -844,10 +844,8 @@ protected function sendRawCommand($command, $params) */ private function parseResponse($params, $command = null) { - $prettyCommand = implode(' ', $params); - if (($line = fgets($this->socket)) === false) { - throw new SocketException("Failed to read from socket.\nRedis command was: " . $prettyCommand); + throw new SocketException("Failed to read from socket.\nRedis command was: " . implode(' ', $params)); } $type = $line[0]; $line = mb_substr($line, 1, -2, '8bit'); @@ -864,7 +862,7 @@ private function parseResponse($params, $command = null) return $this->redirect($line, $command, $params); } - throw new Exception("Redis error: " . $line . "\nRedis command was: " . $prettyCommand); + throw new Exception("Redis error: " . $line . "\nRedis command was: " . implode(' ', $params)); case ':': // Integer reply // no cast to int as it is in the range of a signed 64 bit integer return $line; @@ -876,7 +874,7 @@ private function parseResponse($params, $command = null) $data = ''; while ($length > 0) { if (($block = fread($this->socket, $length)) === false) { - throw new SocketException("Failed to read from socket.\nRedis command was: " . $prettyCommand); + throw new SocketException("Failed to read from socket.\nRedis command was: " . implode(' ', $params)); } $data .= $block; $length -= mb_strlen($block, '8bit'); @@ -892,7 +890,7 @@ private function parseResponse($params, $command = null) return $data; default: - throw new Exception('Received illegal data from redis: ' . $line . "\nRedis command was: " . $prettyCommand); + throw new Exception('Received illegal data from redis: ' . $line . "\nRedis command was: " . implode(' ', $params)); } }