ScriptedCommand.php 644 B

123456789101112131415161718192021
  1. <?php
  2. namespace Predis\Commands;
  3. abstract class ScriptedCommand extends ServerEval {
  4. public abstract function getScript();
  5. protected function keysCount() {
  6. // The default behaviour for the base class is to use all the arguments
  7. // passed to a scripted command to populate the KEYS table in Lua.
  8. return count($this->getArguments());
  9. }
  10. protected function filterArguments(Array $arguments) {
  11. return array_merge(array($this->getScript(), $this->keysCount()), $arguments);
  12. }
  13. protected function getKeys() {
  14. return array_slice($this->getArguments(), 2, $this->keysCount());
  15. }
  16. }