ConnectionFactoryInterface.php 1.7 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\Profile\ServerProfileInterface;
  12. /**
  13. * Interface that must be implemented by classes that provide their own mechanism
  14. * to create and initialize new instances of Predis\Connection\SingleConnectionInterface.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. interface ConnectionFactoryInterface
  19. {
  20. /**
  21. * Defines or overrides the connection class identified by a scheme prefix.
  22. *
  23. * @param string $scheme URI scheme identifying the connection class.
  24. * @param mixed $initializer FQN of a connection class or a callable object for lazy initialization.
  25. */
  26. public function define($scheme, $initializer);
  27. /**
  28. * Undefines the connection identified by a scheme prefix.
  29. *
  30. * @param string $scheme Parameters for the connection.
  31. */
  32. public function undefine($scheme);
  33. /**
  34. * Creates a new connection object.
  35. *
  36. * @param mixed $parameters Parameters for the connection.
  37. * @return Predis\Connection\SingleConnectionInterface
  38. */
  39. public function create($parameters);
  40. /**
  41. * Prepares an aggregation of connection objects.
  42. *
  43. * @param AggregatedConnectionInterface Instance of an aggregated connection class.
  44. * @param array $parameters List of parameters for each connection object.
  45. * @return Predis\Connection\AggregatedConnectionInterface
  46. */
  47. public function createAggregated(AggregatedConnectionInterface $cluster, Array $parameters);
  48. }