AggregateConnectionInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 SingleConnectionInterface $connection Connection instance.
  24. */
  25. public function add(SingleConnectionInterface $connection);
  26. /**
  27. * Removes the specified connection instance from the aggregate connection.
  28. *
  29. * @param SingleConnectionInterface $connection Connection instance.
  30. * @return bool Returns true if the connection was in the pool.
  31. */
  32. public function remove(SingleConnectionInterface $connection);
  33. /**
  34. * Returns the connection instance in charge for the given command.
  35. *
  36. * @param CommandInterface $command Command instance.
  37. * @return SingleConnectionInterface
  38. */
  39. public function getConnection(CommandInterface $command);
  40. /**
  41. * Returns a connection instance from the aggregate connection by its alias.
  42. *
  43. * @param string $connectionID Connection alias.
  44. * @return SingleConnectionInterface
  45. */
  46. public function getConnectionById($connectionID);
  47. }