Forráskód Böngészése

Added missing support for BGREWRITEAOF for Redis >= 1.2.0

Daniele Alessandri 15 éve
szülő
commit
6cb9663539
2 módosított fájl, 14 hozzáadás és 0 törlés
  1. 2 0
      CHANGELOG
  2. 12 0
      lib/Predis.php

+ 2 - 0
CHANGELOG

@@ -5,5 +5,7 @@ v0.5.1
     you can override the server profile if you need the old (and uncorrect)
     behaviour when connecting to a Redis 1.2.0 instance.
 
+  * Added missing support for BGREWRITEAOF for Redis >= 1.2.0
+
 v0.5.0
   * First versioned release of Predis

+ 12 - 0
lib/Predis.php

@@ -1003,6 +1003,10 @@ class RedisServer_v1_2 extends RedisServer_v1_0 {
                 'zsetScore'                 => '\Predis\Commands\ZSetScore',
             'zremrangebyscore'              => '\Predis\Commands\ZSetRemoveRangeByScore',
                 'zsetRemoveRangeByScore'    => '\Predis\Commands\ZSetRemoveRangeByScore',
+
+            /* persistence control commands */
+            'bgrewriteaof'                      =>  '\Predis\Commands\BackgroundRewriteAppendOnlyFile',
+            'backgroundRewriteAppendOnlyFile'   =>  '\Predis\Commands\BackgroundRewriteAppendOnlyFile',
         ));
     }
 }
@@ -1474,6 +1478,14 @@ class BackgroundSave extends \Predis\InlineCommand {
     }
 }
 
+class BackgroundRewriteAppendOnlyFile extends \Predis\InlineCommand {
+    public function canBeHashed()  { return false; }
+    public function getCommandId() { return 'BGREWRITEAOF'; }
+    public function parseResponse($data) {
+        return $data == 'Background append only file rewriting started';
+    }
+}
+
 class LastSave extends \Predis\InlineCommand {
     public function canBeHashed()  { return false; }
     public function getCommandId() { return 'LASTSAVE'; }