浏览代码

Do not use new classes for variadic RPUSH, LPUSH, SADD, SREM and HDEL in the 2.4 profile.

Daniele Alessandri 14 年之前
父节点
当前提交
42521f2558

+ 6 - 0
lib/Predis/Commands/HashDelete.php

@@ -2,11 +2,17 @@
 
 namespace Predis\Commands;
 
+use Predis\Helpers;
+
 class HashDelete extends Command {
     public function getId() {
         return 'HDEL';
     }
 
+    protected function filterArguments(Array $arguments) {
+        return Helpers::filterVariadicValues($arguments);
+    }
+
     public function parseResponse($data) {
         return (bool) $data;
     }

+ 0 - 19
lib/Predis/Commands/HashDeleteV24x.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace Predis\Commands;
-
-use Predis\Helpers;
-
-class HashDeleteV24x extends Command {
-    public function getId() {
-        return 'HDEL';
-    }
-
-    protected function filterArguments(Array $arguments) {
-        return Helpers::filterVariadicValues($arguments);
-    }
-
-    public function parseResponse($data) {
-        return (bool) $data;
-    }
-}

+ 1 - 1
lib/Predis/Commands/ListPushHead.php

@@ -2,7 +2,7 @@
 
 namespace Predis\Commands;
 
-class ListPushHead extends Command {
+class ListPushHead extends ListPushTail {
     public function getId() {
         return 'LPUSH';
     }

+ 0 - 9
lib/Predis/Commands/ListPushHeadV24x.php

@@ -1,9 +0,0 @@
-<?php
-
-namespace Predis\Commands;
-
-class ListPushHeadV24x extends ListPushTailV24x {
-    public function getId() {
-        return 'LPUSH';
-    }
-}

+ 6 - 0
lib/Predis/Commands/ListPushTail.php

@@ -2,8 +2,14 @@
 
 namespace Predis\Commands;
 
+use Predis\Helpers;
+
 class ListPushTail extends Command {
     public function getId() {
         return 'RPUSH';
     }
+
+    protected function filterArguments(Array $arguments) {
+        return Helpers::filterVariadicValues($arguments);
+    }
 }

+ 0 - 15
lib/Predis/Commands/ListPushTailV24x.php

@@ -1,15 +0,0 @@
-<?php
-
-namespace Predis\Commands;
-
-use Predis\Helpers;
-
-class ListPushTailV24x extends Command {
-    public function getId() {
-        return 'RPUSH';
-    }
-
-    protected function filterArguments(Array $arguments) {
-        return Helpers::filterVariadicValues($arguments);
-    }
-}

+ 6 - 0
lib/Predis/Commands/SetAdd.php

@@ -2,11 +2,17 @@
 
 namespace Predis\Commands;
 
+use Predis\Helpers;
+
 class SetAdd extends Command {
     public function getId() {
         return 'SADD';
     }
 
+    protected function filterArguments(Array $arguments) {
+        return Helpers::filterVariadicValues($arguments);
+    }
+
     public function parseResponse($data) {
         return (bool) $data;
     }

+ 0 - 19
lib/Predis/Commands/SetAddV24x.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace Predis\Commands;
-
-use Predis\Helpers;
-
-class SetAddV24x extends Command {
-    public function getId() {
-        return 'SADD';
-    }
-
-    protected function filterArguments(Array $arguments) {
-        return Helpers::filterVariadicValues($arguments);
-    }
-
-    public function parseResponse($data) {
-        return (bool) $data;
-    }
-}

+ 6 - 0
lib/Predis/Commands/SetRemove.php

@@ -2,11 +2,17 @@
 
 namespace Predis\Commands;
 
+use Predis\Helpers;
+
 class SetRemove extends Command {
     public function getId() {
         return 'SREM';
     }
 
+    protected function filterArguments(Array $arguments) {
+        return Helpers::filterVariadicValues($arguments);
+    }
+
     public function parseResponse($data) {
         return (bool) $data;
     }

+ 0 - 19
lib/Predis/Commands/SetRemoveV24x.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace Predis\Commands;
-
-use Predis\Helpers;
-
-class SetRemoveV24x extends Command {
-    public function getId() {
-        return 'SREM';
-    }
-
-    protected function filterArguments(Array $arguments) {
-        return Helpers::filterVariadicValues($arguments);
-    }
-
-    public function parseResponse($data) {
-        return (bool) $data;
-    }
-}

+ 0 - 11
lib/Predis/Profiles/ServerVersionNext.php

@@ -6,17 +6,6 @@ class ServerVersionNext extends ServerVersion22 {
     public function getVersion() { return '2.4'; }
     public function getSupportedCommands() {
         return array_merge(parent::getSupportedCommands(), array(
-            /* commands operating on lists */
-            'rpush'                     => '\Predis\Commands\ListPushTailV24x',
-            'lpush'                     => '\Predis\Commands\ListPushHeadV24x',
-
-            /* commands operating on sets */
-            'sadd'                      => '\Predis\Commands\SetAddV24x',
-            'srem'                      => '\Predis\Commands\SetRemoveV24x',
-
-            /* commands operating on hashes */
-            'hdel'                      => '\Predis\Commands\HashDeleteV24x',
-
             /* remote server control commands */
             'info'                      => '\Predis\Commands\ServerInfoV24x',
             'client'                    => '\Predis\Commands\ServerClient',