ConnectionFactoryInterface.php 1.7 KB

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