ソースを参照

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

Daniele Alessandri 14 年 前
コミット
8787930977

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

@@ -0,0 +1,20 @@
+<?php
+
+namespace Predis\Commands;
+
+class HashDeleteV24x extends Command {
+    public function getId() {
+        return 'HDEL';
+    }
+
+    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;
+    }
+}

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

@@ -13,6 +13,9 @@ class ServerVersionNext extends ServerVersion22 {
             /* commands operating on sets */
             /* commands operating on sets */
             'sadd'                      => '\Predis\Commands\SetAddV24x',
             'sadd'                      => '\Predis\Commands\SetAddV24x',
 
 
+            /* commands operating on hashes */
+            'hdel'                      => '\Predis\Commands\HashDeleteV24x',
+
             /* remote server control commands */
             /* remote server control commands */
             'info'                  => '\Predis\Commands\InfoV24x',
             'info'                  => '\Predis\Commands\InfoV24x',
         ));
         ));