KeyDelete.php 867 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Commands;
  11. use Predis\Helpers;
  12. class KeyDelete extends Command
  13. {
  14. public function getId()
  15. {
  16. return 'DEL';
  17. }
  18. protected function filterArguments(Array $arguments)
  19. {
  20. return Helpers::filterArrayArguments($arguments);
  21. }
  22. protected function onPrefixKeys(Array $arguments, $prefix)
  23. {
  24. return PrefixHelpers::multipleKeys($arguments, $prefix);
  25. }
  26. protected function canBeHashed()
  27. {
  28. $args = $this->getArguments();
  29. if (count($args) === 1) {
  30. return true;
  31. }
  32. return $this->checkSameHashForKeys($args);
  33. }
  34. }