IConnectionCluster.php 1.5 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\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. * Removes the specified connection instance from the cluster.
  28. *
  29. * @param IConnectionSingle $connection Instance of a connection.
  30. * @return Boolean Returns true if the connection was in the pool.
  31. */
  32. public function remove(IConnectionSingle $connection);
  33. /**
  34. * Gets the actual connection instance in charge of the specified command.
  35. *
  36. * @param ICommand $command Instance of a Redis command.
  37. * @return IConnectionSingle
  38. */
  39. public function getConnection(ICommand $command);
  40. /**
  41. * Retrieves a connection instance from the cluster using an alias.
  42. *
  43. * @param string $connectionId Alias of a connection
  44. * @return IConnectionSingle
  45. */
  46. public function getConnectionById($connectionId);
  47. }