| Conditions | 4 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function register(ContainerInterface $app) |
||
| 18 | { |
||
| 19 | $app->closure(Cache::class, function (Config $config, ContainerInterface $app) { |
||
| 20 | switch ($config->get('cache.type')) { |
||
| 21 | case 'apcu': |
||
| 22 | $cache = new ApcuCache(); |
||
| 23 | break; |
||
| 24 | case 'memcached': |
||
| 25 | $cache = new MemcachedCache(); |
||
| 26 | $cache->setMemcached($app->get(Memcached::class)); |
||
| 27 | break; |
||
| 28 | case 'redis': |
||
| 29 | $cache = new RedisCache(); |
||
| 30 | $cache->setRedis(Client::class); |
||
| 31 | break; |
||
| 32 | default: |
||
| 33 | $cache = new FilesystemCache(sys_get_temp_dir()); |
||
| 34 | } |
||
| 35 | $cache->setNamespace('wandu.doctrine.cache.'); |
||
| 36 | return $cache; |
||
| 37 | }); |
||
| 38 | } |
||
| 39 | |||
| 44 |