mirror of
https://github.com/predis/predis.git
synced 2026-10-10 13:57:22 +00:00
Client handles -NOSCRIPT falling back to EVAL for scripted commands.
Now Predis\Command\ScriptedCommand uses EVALSHA instead of EVAL internally so that performances should be better since the client do not resend the Lua script body on each call. Plain EVALSHA commands are not affected and will return or throw the error.
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Predis\Command;
|
||||
* @link http://redis.io/commands/eval
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
abstract class ScriptedCommand extends ServerEval
|
||||
abstract class ScriptedCommand extends ServerEvalSHA
|
||||
{
|
||||
/**
|
||||
* Gets the body of a Lua script.
|
||||
@@ -67,6 +67,17 @@ abstract class ScriptedCommand extends ServerEval
|
||||
$numkeys = count($arguments);
|
||||
}
|
||||
|
||||
return array_merge(array($this->getScript(), $numkeys), $arguments);
|
||||
return array_merge(array(sha1($this->getScript()), $numkeys), $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEvalArguments()
|
||||
{
|
||||
$arguments = $this->getArguments();
|
||||
$arguments[0] = $this->getScript();
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user