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