1 | <?php |
||
7 | class Predis extends BaseConnection implements ConnectionInterface |
||
8 | { |
||
9 | /** |
||
10 | * Client |
||
11 | * |
||
12 | * @var \Predis\Client |
||
13 | */ |
||
14 | protected $client; |
||
15 | |||
16 | /** |
||
17 | * @inheritdoc |
||
18 | */ |
||
19 | 1 | public function connect($connectionTimeout = null, $responseTimeout = null) |
|
27 | |||
28 | /** |
||
29 | * @inheritdoc |
||
30 | */ |
||
31 | 8 | public function disconnect() |
|
39 | |||
40 | /** |
||
41 | * @inheritdoc |
||
42 | */ |
||
43 | 8 | public function isConnected() |
|
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | 3 | public function execute(CommandInterface $command) |
|
52 | { |
||
53 | 3 | if (!$this->isConnected()) { |
|
54 | 1 | throw new ConnectionException('No connection established'); |
|
55 | } |
||
56 | 2 | return $this->client->executeRaw(array_merge( |
|
57 | 2 | [$command->getCommand()], |
|
58 | 2 | $command->getArguments() |
|
59 | 2 | )); |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * Build Predis client |
||
64 | * |
||
65 | * @param string $host Host |
||
66 | * @param int $port Port |
||
67 | * @return Predis\Client Client |
||
68 | */ |
||
69 | protected function buildClient($host, $port) |
||
73 | } |
||
74 |