Browse Source

New commands: PSUBSCRIBE and PUNSUBSCRIBE (Redis v2.0-dev).

Daniele Alessandri 15 years ago
parent
commit
27ebb1ddb5
1 changed files with 12 additions and 0 deletions
  1. 12 0
      lib/Predis.php

+ 12 - 0
lib/Predis.php

@@ -1511,6 +1511,8 @@ class RedisServer_vNext extends RedisServer_v1_2 {
             /* publish - subscribe */
             'subscribe'                 => '\Predis\Commands\Subscribe',
             'unsubscribe'               => '\Predis\Commands\Unsubscribe',
+            'psubscribe'                => '\Predis\Commands\SubscribeByPattern',
+            'punsubscribe'              => '\Predis\Commands\UnsubscribeByPattern',
             'publish'                   => '\Predis\Commands\Publish',
 
             /* remote server control commands */
@@ -2348,6 +2350,16 @@ class Unsubscribe extends \Predis\MultiBulkCommand {
     public function getCommandId() { return 'UNSUBSCRIBE'; }
 }
 
+class SubscribeByPattern extends \Predis\MultiBulkCommand {
+    public function canBeHashed()  { return false; }
+    public function getCommandId() { return 'PSUBSCRIBE'; }
+}
+
+class UnsubscribeByPattern extends \Predis\MultiBulkCommand {
+    public function canBeHashed()  { return false; }
+    public function getCommandId() { return 'PUNSUBSCRIBE'; }
+}
+
 class Publish extends \Predis\MultiBulkCommand {
     public function canBeHashed()  { return false; }
     public function getCommandId() { return 'PUBLISH'; }