Эх сурвалжийг харах

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 жил өмнө
parent
commit
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();
+            }
         }
     }