From ca22208ce87f8bb2e00a40905815a0e48b85540b Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 3 May 2011 18:00:30 +0200 Subject: [PATCH] Define a default value for the number of values used to populate KEYS. --- lib/Predis/Commands/ScriptedCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Predis/Commands/ScriptedCommand.php b/lib/Predis/Commands/ScriptedCommand.php index 69c9ca0c..564b25de 100644 --- a/lib/Predis/Commands/ScriptedCommand.php +++ b/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) {