Pārlūkot izejas kodu

Define a default value for the number of values used to populate KEYS.

Daniele Alessandri 14 gadi atpakaļ
vecāks
revīzija
ca22208ce8
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6 1
      lib/Predis/Commands/ScriptedCommand.php

+ 6 - 1
lib/Predis/Commands/ScriptedCommand.php

@@ -5,7 +5,12 @@ namespace Predis\Commands;
 abstract class ScriptedCommand extends ServerEval {
     public abstract function getScript();
 
-    public abstract function keysCount();
+    protected function keysCount() {
+        // The default behaviour is to use the first argument as the only value
+        // for KEYS and the rest of the arguments (if any) for ARGV. When -1 is
+        // returned, all the arguments are considered as values for KEYS.
+        return 1;
+    }
 
     protected function filterArguments(Array $arguments) {
         if (($keys = $this->keysCount()) === -1) {