Passed
Push — master ( b2988e...9f380c )
by Jonathan
33:05
created

ZendDataCache   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 52
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A doSave() 0 3 1
A doDelete() 0 3 1
A doGetStats() 0 3 1
A doFlush() 0 7 2
A doContains() 0 3 1
A doFetch() 0 3 1
1
<?php
2
3
namespace Doctrine\Common\Cache;
4
5
use function zend_shm_cache_clear;
6
use function zend_shm_cache_delete;
7
use function zend_shm_cache_fetch;
8
use function zend_shm_cache_store;
9
10
/**
11
 * Zend Data Cache cache driver.
12
 *
13
 * @link   www.doctrine-project.org
14
 */
15
class ZendDataCache extends CacheProvider
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    protected function doFetch($id)
21
    {
22
        return zend_shm_cache_fetch($id);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    protected function doContains($id)
29
    {
30
        return zend_shm_cache_fetch($id) !== false;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function doSave($id, $data, $lifeTime = 0)
37
    {
38
        return zend_shm_cache_store($id, $data, $lifeTime);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function doDelete($id)
45
    {
46
        return zend_shm_cache_delete($id);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function doFlush()
53
    {
54
        $namespace = $this->getNamespace();
55
        if (empty($namespace)) {
56
            return zend_shm_cache_clear();
57
        }
58
        return zend_shm_cache_clear($namespace);
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    protected function doGetStats()
65
    {
66
        return null;
67
    }
68
}
69