CacheBootloader::makeCache()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Spiral\PhpFastCache;
4
5
use phpFastCache\CacheManager;
6
use Psr\Cache\CacheItemPoolInterface;
7
use Psr\SimpleCache\CacheInterface;
8
use Spiral\Core\Bootloaders\Bootloader;
9
10
class CacheBootloader extends Bootloader
11
{
12
    const BINDINGS = [
13
        'cache'               => CacheInterface::class,
14
        CacheInterface::class => SimpleCacheAdapter::class
15
    ];
16
17
    const SINGLETONS = [
18
        CacheItemPoolInterface::class => [self::class, 'makeCache']
19
    ];
20
21
    protected function makeCache(Config $config): CacheItemPoolInterface
22
    {
23
        return CacheManager::getInstance($config->getAdapter(), $config->getAdapterOptions());
24
    }
25
}