Bladeren bron

New commands: INCRBYFLOAT, HINCRBYFLOAT (Redis v2.6-dev).

Daniele Alessandri 13 jaren geleden
bovenliggende
commit
5d04cf540d

+ 1 - 1
TODO

@@ -14,4 +14,4 @@
 * Missing tests for commands:
     PUBLISH, SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, DEBUG, OBJECT,
     CLIENT, CONFIG GET, CONFIG SET, CONFIG RESETSTAT, SLOWLOG, SCRIPT, PTTL,
-    PSETEX, PEXPIRE, PEXPIREAT
+    PSETEX, PEXPIRE, PEXPIREAT, INCRBYFLOAT, HINCRBYFLOAT

+ 27 - 0
lib/Predis/Commands/HashIncrementByFloat.php

@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * This file is part of the Predis package.
+ *
+ * (c) Daniele Alessandri <suppakilla@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Predis\Commands;
+
+/**
+ * @link http://redis.io/commands/hincrbyfloat
+ * @author Daniele Alessandri <suppakilla@gmail.com>
+ */
+class HashIncrementByFloat extends Command
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getId()
+    {
+        return 'HINCRBYFLOAT';
+    }
+}

+ 27 - 0
lib/Predis/Commands/StringIncrementByFloat.php

@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * This file is part of the Predis package.
+ *
+ * (c) Daniele Alessandri <suppakilla@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Predis\Commands;
+
+/**
+ * @link http://redis.io/commands/incrbyfloat
+ * @author Daniele Alessandri <suppakilla@gmail.com>
+ */
+class StringIncrementByFloat extends Command
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getId()
+    {
+        return 'INCRBYFLOAT';
+    }
+}

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

@@ -39,6 +39,10 @@ class ServerVersionNext extends ServerVersion24
 
             /* commands operating on string values */
             'psetex'                    => '\Predis\Commands\StringPreciseSetExpire',
+            'incrbyfloat'               => '\Predis\Commands\StringIncrementByFloat',
+
+            /* commands operating on hashes */
+            'hincrbyfloat'              => '\Predis\Commands\HashIncrementByFloat',
 
             /* scripting */
             'eval'                      => '\Predis\Commands\ServerEval',