FactoryInterface.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. * @return SingleConnectionInterface
  36. */
  37. public function create($parameters);
  38. /**
  39. * Aggregates single connections into an aggregate connection instance.
  40. *
  41. * @param AggregateConnectionInterface $aggregate Aggregate connection instance.
  42. * @param array $parameters List of parameters for each connection.
  43. */
  44. public function aggregate(AggregateConnectionInterface $aggregate, array $parameters);
  45. }