Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function createConnection(string $driver, array $config = []): RedisManager |
||
27 | { |
||
28 | $host = getenv('REDIS_HOST') ?: '127.0.0.1'; |
||
29 | $port = getenv('REDIS_PORT') ?: 6379; |
||
30 | $defaultConfig = [ |
||
31 | 'cluster' => false, |
||
32 | 'default' => [ |
||
33 | 'host' => $host, |
||
34 | 'port' => $port, |
||
35 | 'database' => 5, |
||
36 | 'options' => ['prefix' => 'lodash:'], |
||
37 | 'timeout' => 0.5, |
||
38 | 'read_timeout' => 1.5, |
||
39 | ], |
||
40 | ]; |
||
41 | $options = array_replace_recursive($defaultConfig, $config); |
||
42 | |||
43 | $redis = new RedisManager($this->app, $driver, $options); |
||
44 | |||
45 | return $redis; |
||
46 | } |
||
47 | } |
||
48 |