ソースを参照

Add support for transparent key prefixing to EVAL and the Predis\Commands\ScriptedCommand class.

Daniele Alessandri 14 年 前
コミット
909b06e805
1 ファイル変更8 行追加0 行削除
  1. 8 0
      lib/Predis/Commands/ServerEval.php

+ 8 - 0
lib/Predis/Commands/ServerEval.php

@@ -7,6 +7,14 @@ class ServerEval extends Command {
         return 'EVAL';
     }
 
+    protected function onPrefixKeys(Array $arguments, $prefix) {
+        $arguments = $this->getArguments();
+        for ($i = 2; $i < $arguments[1] + 2; $i++) {
+            $arguments[$i] = "$prefix{$arguments[$i]}";
+        }
+        return $arguments;
+    }
+
     protected function canBeHashed() {
         return false;
     }