DoctrineCache::save()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
namespace Sesshin\Store;
3
4
use Doctrine\Common\Cache\Cache;
5
6
/**
7
 * Uses doctrine/cache as a stroing engine.
8
 */
9
class DoctrineCache implements StoreInterface
10
{
11
    /** @var Cache */
12
    protected $cache;
13
14
    /**
15
     * @param Cache $cache
16
     */
17
    public function __construct(Cache $cache)
18
    {
19
        $this->cache = $cache;
20
    }
21
22
    /**
23
     * @param string $id
24
     * @return bool|mixed
25
     */
26
    public function fetch($id)
27
    {
28
        return $this->cache->fetch($id);
29
    }
30
31
    /**
32
     * @param string $id
33
     * @param mixed $data
34
     * @param int $lifeTime
35
     * @return bool
36
     */
37
    public function save($id, $data, $lifeTime)
38
    {
39
        return $this->cache->save($id, $data, $lifeTime);
40
    }
41
42
    /**
43
     * @param string $id
44
     * @return bool
45
     */
46
    public function delete($id)
47
    {
48
        return $this->cache->delete($id);
49
    }
50
51
    /**
52
     * @return Cache
53
     */
54
    public function getCache()
55
    {
56
        return $this->cache;
57
    }
58
}
59