AggregatedConnectionInterface.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 by multiple connection objects.
  14. *
  15. * @author Daniele Alessandri <suppakilla@gmail.com>
  16. */
  17. interface AggregatedConnectionInterface extends ConnectionInterface
  18. {
  19. /**
  20. * Adds a connection instance to the aggregated connection.
  21. *
  22. * @param SingleConnectionInterface $connection Instance of a connection.
  23. */
  24. public function add(SingleConnectionInterface $connection);
  25. /**
  26. * Removes the specified connection instance from the aggregated
  27. * connection.
  28. *
  29. * @param SingleConnectionInterface $connection Instance of a connection.
  30. * @return Boolean Returns true if the connection was in the pool.
  31. */
  32. public function remove(SingleConnectionInterface $connection);
  33. /**
  34. * Gets the actual connection instance in charge of the specified command.
  35. *
  36. * @param CommandInterface $command Instance of a Redis command.
  37. * @return SingleConnectionInterface
  38. */
  39. public function getConnection(CommandInterface $command);
  40. /**
  41. * Retrieves a connection instance from the aggregated connection
  42. * using an alias.
  43. *
  44. * @param string $connectionId Alias of a connection
  45. * @return SingleConnectionInterface
  46. */
  47. public function getConnectionById($connectionId);
  48. }