IConnectionCluster.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\Network;
  11. use Predis\Commands\ICommand;
  12. /**
  13. * Defines a cluster of Redis servers formed by aggregating multiple
  14. * connection objects.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. interface IConnectionCluster extends IConnection
  19. {
  20. /**
  21. * Adds a connection instance to the cluster.
  22. *
  23. * @param IConnectionSingle $connection Instance of a connection.
  24. */
  25. public function add(IConnectionSingle $connection);
  26. /**
  27. * Gets the actual connection instance in charge of the specified command.
  28. *
  29. * @param ICommand $command Instance of a Redis command.
  30. * @return IConnectionSingle
  31. */
  32. public function getConnection(ICommand $command);
  33. /**
  34. * Retrieves a connection instance from the cluster using an alias.
  35. *
  36. * @param string $connectionId Alias of a connection
  37. * @return IConnectionSingle
  38. */
  39. public function getConnectionById($connectionId);
  40. }