ICommand.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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\Distribution\INodeKeyGenerator;
  12. /**
  13. * Defines an abstraction representing a Redis command.
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. interface ICommand
  17. {
  18. /**
  19. * Gets the ID of a Redis command.
  20. *
  21. * @return string
  22. */
  23. public function getId();
  24. /**
  25. * Returns an hash of the command using the provided algorithm against the
  26. * key (used to calculate the distribution of keys with client-side sharding).
  27. *
  28. * @param INodeKeyGenerator $distributor Distribution algorithm.
  29. * @return int
  30. */
  31. public function getHash(INodeKeyGenerator $distributor);
  32. /**
  33. * Sets the arguments of the command.
  34. *
  35. * @param array $arguments List of arguments.
  36. */
  37. public function setArguments(Array $arguments);
  38. /**
  39. * Gets the arguments of the command.
  40. *
  41. * @return array
  42. */
  43. public function getArguments();
  44. /**
  45. * Parses a reply buffer and returns a PHP object.
  46. *
  47. * @param string $data Binary string containing the whole reply.
  48. * @return mixed
  49. */
  50. public function parseResponse($data);
  51. }