Total Complexity | 7 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class ChainBuilder |
||
11 | { |
||
12 | private SimpleCache\Chain $chain; |
||
13 | |||
14 | private ?string $namespace; |
||
15 | |||
16 | private ?int $defaultTTL; |
||
17 | |||
18 | private function __construct(?string $namespace = null, int $defaultTTL = null) |
||
24 | } |
||
25 | |||
26 | public static function create(?string $namespace = null, int $defaultTTL = null): self |
||
27 | { |
||
28 | return new self($namespace, $defaultTTL); |
||
29 | } |
||
30 | |||
31 | public function addMemcached(\Memcached $memcached): self |
||
32 | { |
||
33 | $this->chain->addAdapter(SimpleCache\Memcached::create($memcached)); |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | public function addRedis(\Redis $redis): self |
||
39 | { |
||
40 | $this->chain->addAdapter(SimpleCache\Redis::create($redis)); |
||
41 | |||
42 | return $this; |
||
43 | } |
||
44 | |||
45 | public function addMemory(int $maxItems = null): self |
||
46 | { |
||
47 | $this->chain->addAdapter(SimpleCache\Memory::create($maxItems)); |
||
48 | |||
49 | return $this; |
||
50 | } |
||
51 | |||
52 | public function addAPCu(): self |
||
57 | } |
||
58 | |||
59 | public function build(): Cache\CacheItemPoolInterface |
||
62 | } |
||
63 | } |
||
64 |