| Conditions | 2 |
| Paths | 1 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function register(DiInterface $container) |
||
| 21 | { |
||
| 22 | $container->setShared( |
||
| 23 | 'modelsCache', |
||
| 24 | function () use ($container) { |
||
| 25 | if (!$container->getConfig()->app->production) { |
||
| 26 | $frontCache = new None(); |
||
| 27 | $cache = new Memory($frontCache); |
||
| 28 | } else { |
||
| 29 | $frontCache = new Data([ |
||
| 30 | 'lifetime' => envValue('MODELS_CACHE_LIFETIME', 86400), |
||
| 31 | ]); |
||
| 32 | |||
| 33 | $cache = new Redis( |
||
| 34 | $frontCache, |
||
| 35 | [ |
||
| 36 | 'host' => envValue('REDIS_HOST', '127.0.0.1'), |
||
| 37 | 'port' => envValue('REDIS_PORT', 6379), |
||
| 38 | 'prefix' => 'modelsCache', |
||
| 39 | ] |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | return $cache; |
||
| 44 | } |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |