浏览代码

Implement variadic SREM in the development profile (Redis v2.4).

Daniele Alessandri 14 年之前
父节点
当前提交
819f3ca6ed
共有 2 个文件被更改,包括 21 次插入0 次删除
  1. 20 0
      lib/Predis/Commands/SetRemoveV24x.php
  2. 1 0
      lib/Predis/Profiles/ServerVersionNext.php

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

@@ -0,0 +1,20 @@
+<?php
+
+namespace Predis\Commands;
+
+class SetRemoveV24x extends Command {
+    public function getId() {
+        return 'SREM';
+    }
+
+    public function filterArguments(Array $arguments) {
+        if (count($arguments) === 2 && is_array($arguments[1])) {
+            return array_merge(array($arguments[0]), $arguments[1]);
+        }
+        return $arguments;
+    }
+
+    public function parseResponse($data) {
+        return (bool) $data;
+    }
+}

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

@@ -12,6 +12,7 @@ class ServerVersionNext extends ServerVersion22 {
 
             /* commands operating on sets */
             'sadd'                      => '\Predis\Commands\SetAddV24x',
+            'srem'                      => '\Predis\Commands\SetRemoveV24x',
 
             /* commands operating on hashes */
             'hdel'                      => '\Predis\Commands\HashDeleteV24x',