ConnectionInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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\Connection;
  11. use Predis\Command\CommandInterface;
  12. /**
  13. * Defines a connection object used to communicate with one or multiple
  14. * Redis servers.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. interface ConnectionInterface
  19. {
  20. /**
  21. * Opens the connection.
  22. */
  23. public function connect();
  24. /**
  25. * Closes the connection.
  26. */
  27. public function disconnect();
  28. /**
  29. * Returns if the connection is open.
  30. *
  31. * @return Boolean
  32. */
  33. public function isConnected();
  34. /**
  35. * Write a Redis command on the connection.
  36. *
  37. * @param CommandInterface $command Instance of a Redis command.
  38. */
  39. public function writeCommand(CommandInterface $command);
  40. /**
  41. * Reads the reply for a Redis command from the connection.
  42. *
  43. * @param CommandInterface $command Instance of a Redis command.
  44. * @return mixed
  45. */
  46. public function readResponse(CommandInterface $command);
  47. /**
  48. * Writes a Redis command to the connection and reads back the reply.
  49. *
  50. * @param CommandInterface $command Instance of a Redis command.
  51. * @return mixed
  52. */
  53. public function executeCommand(CommandInterface $command);
  54. }