AggregateConnectionInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 virtual connection composed of multiple connection instances to
  14. * single Redis nodes.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. interface AggregateConnectionInterface extends ConnectionInterface
  19. {
  20. /**
  21. * Adds a connection instance to the aggregate connection.
  22. *
  23. * @param NodeConnectionInterface $connection Connection instance.
  24. */
  25. public function add(NodeConnectionInterface $connection);
  26. /**
  27. * Removes the specified connection instance from the aggregate connection.
  28. *
  29. * @param NodeConnectionInterface $connection Connection instance.
  30. *
  31. * @return bool Returns true if the connection was in the pool.
  32. */
  33. public function remove(NodeConnectionInterface $connection);
  34. /**
  35. * Returns the connection instance in charge for the given command.
  36. *
  37. * @param CommandInterface $command Command instance.
  38. *
  39. * @return NodeConnectionInterface
  40. */
  41. public function getConnection(CommandInterface $command);
  42. /**
  43. * Returns a connection instance from the aggregate connection by its alias.
  44. *
  45. * @param string $connectionID Connection alias.
  46. *
  47. * @return NodeConnectionInterface|null
  48. */
  49. public function getConnectionById($connectionID);
  50. }