ZendDataCache   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 53
ccs 0
cts 27
cp 0
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A doContains() 0 3 1
A doSave() 0 3 1
A doDelete() 0 3 1
A doGetStats() 0 3 1
A doFlush() 0 8 2
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
59
        return zend_shm_cache_clear($namespace);
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    protected function doGetStats()
66
    {
67
        return null;
68
    }
69
}
70