FactoryInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 for classes providing a factory of connections to Redis nodes.
  13. *
  14. * @author Daniele Alessandri <suppakilla@gmail.com>
  15. */
  16. interface FactoryInterface
  17. {
  18. /**
  19. * Defines or overrides the connection class identified by a scheme prefix.
  20. *
  21. * @param string $scheme Target connection scheme.
  22. * @param mixed $initializer Fully-qualified name of a class or a callable for lazy initialization.
  23. */
  24. public function define($scheme, $initializer);
  25. /**
  26. * Undefines the connection identified by a scheme prefix.
  27. *
  28. * @param string $scheme Target connection scheme.
  29. */
  30. public function undefine($scheme);
  31. /**
  32. * Creates a new connection object.
  33. *
  34. * @param mixed $parameters Initialization parameters for the connection.
  35. *
  36. * @return NodeConnectionInterface
  37. */
  38. public function create($parameters);
  39. /**
  40. * Aggregates single connections into an aggregate connection instance.
  41. *
  42. * @param AggregateConnectionInterface $aggregate Aggregate connection instance.
  43. * @param array $parameters List of parameters for each connection.
  44. */
  45. public function aggregate(AggregateConnectionInterface $aggregate, array $parameters);
  46. }