Browse Source

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 năm trước cách đây
mục cha
commit
761e3a2527
1 tập tin đã thay đổi với 11 bổ sung3 xóa
  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();
+            }
         }
     }