1<?php
2
3/*
4 * This file is part of the Predis package.
5 *
6 * (c) Daniele Alessandri <suppakilla@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Predis\Connection;
13
14/**
15 * Interface for classes providing a factory of connections to Redis nodes.
16 *
17 * @author Daniele Alessandri <suppakilla@gmail.com>
18 */
19interface FactoryInterface
20{
21    /**
22     * Defines or overrides the connection class identified by a scheme prefix.
23     *
24     * @param string $scheme      Target connection scheme.
25     * @param mixed  $initializer Fully-qualified name of a class or a callable for lazy initialization.
26     */
27    public function define($scheme, $initializer);
28
29    /**
30     * Undefines the connection identified by a scheme prefix.
31     *
32     * @param string $scheme Target connection scheme.
33     */
34    public function undefine($scheme);
35
36    /**
37     * Creates a new connection object.
38     *
39     * @param mixed $parameters Initialization parameters for the connection.
40     *
41     * @return NodeConnectionInterface
42     */
43    public function create($parameters);
44
45    /**
46     * Aggregates single connections into an aggregate connection instance.
47     *
48     * @param AggregateConnectionInterface $aggregate  Aggregate connection instance.
49     * @param array                        $parameters List of parameters for each connection.
50     */
51    public function aggregate(AggregateConnectionInterface $aggregate, array $parameters);
52}
53