Browse Source

Added BLPOP and BRPOP.

Daniele Alessandri 15 năm trước cách đây
mục cha
commit
f3aeecef37
1 tập tin đã thay đổi với 21 bổ sung0 xóa
  1. 21 0
      lib/Predis.php

+ 21 - 0
lib/Predis.php

@@ -886,6 +886,19 @@ class RedisServer__V1_2 extends RedisServer__V1_0 {
     }
 }
 
+class RedisServer__Futures extends RedisServer__V1_2 {
+    public function getVersion() { return 0; }
+    public function getSupportedCommands() {
+        return array_merge(parent::getSupportedCommands(), array(
+            /* commands operating on lists */
+            'blpop'                     => '\Predis\Commands\ListPopFirstBlocking',
+                'popFirstBlocking'      => '\Predis\Commands\ListPopFirstBlocking',
+            'brpop'                     => '\Predis\Commands\ListPopLastBlocking',
+                'popLastBlocking'       => '\Predis\Commands\ListPopLastBlocking'
+        ));
+    }
+}
+
 /* ------------------------------------------------------------------------- */
 
 namespace Predis\Utilities;
@@ -1137,6 +1150,14 @@ class ListPopLast extends \Predis\InlineCommand {
     public function getCommandId() { return 'RPOP'; }
 }
 
+class ListPopFirstBlocking extends \Predis\InlineCommand {
+    public function getCommandId() { return 'BRPOP'; }
+}
+
+class ListPopLastBlocking extends \Predis\InlineCommand {
+    public function getCommandId() { return 'BRPOP'; }
+}
+
 /* commands operating on sets */
 class SetAdd extends \Predis\BulkCommand {
     public function getCommandId() { return 'SADD'; }