ソースを参照

Add an optional argument to MultiBulkResponseIterator::sync() to specify if the synchronization of an iterable multibulk response should be performed by consuming the rest of the reply or by closing the underlying connection.

Daniele Alessandri 15 年 前
コミット
761e3a2527
1 ファイル変更11 行追加3 行削除
  1. 11 3
      lib/Predis.php

+ 11 - 3
lib/Predis.php

@@ -2022,9 +2022,17 @@ class MultiBulkResponseIterator extends MultiBulkResponseIteratorBase {
         $this->sync();
     }
 
-    public function sync() {
-        while ($this->valid()) {
-            $this->next();
+    public function sync($drop = false) {
+        if ($drop == true) {
+            if ($this->valid()) {
+                $this->_position = $this->_replySize;
+                $this->_connection->disconnect();
+            }
+        }
+        else {
+            while ($this->valid()) {
+                $this->next();
+            }
         }
     }