CommandInterface.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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\Command;
  11. /**
  12. * Defines an abstraction representing a Redis command.
  13. *
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. interface CommandInterface
  17. {
  18. /**
  19. * Returns the ID of the Redis command. By convention, command identifiers
  20. * must always be uppercase.
  21. *
  22. * @return string
  23. */
  24. public function getId();
  25. /**
  26. * Assign the specified slot to the command for clustering distribution.
  27. *
  28. * @param int $slot Slot ID.
  29. */
  30. public function setSlot($slot);
  31. /**
  32. * Returns the assigned slot of the command for clustering distribution.
  33. *
  34. * @return int|null
  35. */
  36. public function getSlot();
  37. /**
  38. * Sets the arguments for the command.
  39. *
  40. * @param array $arguments List of arguments.
  41. */
  42. public function setArguments(array $arguments);
  43. /**
  44. * Sets the raw arguments for the command without processing them.
  45. *
  46. * @param array $arguments List of arguments.
  47. */
  48. public function setRawArguments(array $arguments);
  49. /**
  50. * Gets the arguments of the command.
  51. *
  52. * @return array
  53. */
  54. public function getArguments();
  55. /**
  56. * Gets the argument of the command at the specified index.
  57. *
  58. * @param int $index Index of the desired argument.
  59. *
  60. * @return mixed|null
  61. */
  62. public function getArgument($index);
  63. /**
  64. * Parses a raw response and returns a PHP object.
  65. *
  66. * @param string $data Binary string containing the whole response.
  67. *
  68. * @return mixed
  69. */
  70. public function parseResponse($data);
  71. }