ZendDataCache::doSave()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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