Completed
Push — apc-module ( 2cc8cc...2718a4 )
by Akihito
01:44
created

StorageApcCacheProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 7 1
1
<?php
2
/**
3
 * This file is part of the BEAR.QueryRepository package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\QueryRepository;
8
9
use Doctrine\Common\Cache\ApcuCache;
10
use Ray\Di\Di\Named;
11
use Ray\Di\ProviderInterface;
12
13
class StorageApcCacheProvider implements ProviderInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    private $namespace;
19
20
    /**
21
     * @Named("namespace=cache_namespace")
22
     */
23
    public function __construct(string $namespace = '')
24
    {
25
        $this->namespace = $namespace;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function get()
32
    {
33
        $cache = new ApcuCache;
34
        $cache->setNamespace($this->namespace);
35
36
        return $cache;
37
    }
38
}
39