Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
21 | public function getRedisCachePool(): CacheItemPoolInterface |
||
22 | { |
||
23 | $redis = new Redis(); |
||
24 | |||
25 | $cacheSettings = $this->config->getCacheSettings(); |
||
26 | |||
27 | if ($cacheSettings->getRedisSocket() !== null) { |
||
28 | try { |
||
29 | $redis->connect($cacheSettings->getRedisSocket()); |
||
30 | } catch (Exception $e) { |
||
31 | $redis->connect( |
||
32 | $cacheSettings->getRedisHost(), |
||
33 | $cacheSettings->getRedisPort() |
||
34 | ); |
||
35 | } |
||
36 | } else { |
||
37 | $redis->connect( |
||
38 | $cacheSettings->getRedisHost(), |
||
39 | $cacheSettings->getRedisPort() |
||
40 | ); |
||
41 | } |
||
42 | $redis->setOption(Redis::OPT_PREFIX, $this->config->getDbSettings()->getDatabase()); |
||
43 | |||
44 | return new RedisCachePool($redis); |
||
45 | } |
||
47 |