SimpleCacheAdapter::clear()   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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Vectorface\Cache;
4
5
use Psr\SimpleCache\CacheInterface;
6
use Traversable;
7
8
/**
9
 * Adapts a Vectorface cache instance to the PSR SimpleCache interface.
10
 */
11
class SimpleCacheAdapter implements CacheInterface
12
{
13
    /**
14
     * Create an adapter over a Vectorface cache instance to the SimpleCache interface.
15
     *
16
     * @param Cache $cache
17
     */
18
    public function __construct(
19
        protected Cache $cache,
20
    ) {}
21 10
22
    /**
23 10
     * @inheritDoc
24 10
     */
25
    public function get($key, $default = null)
26
    {
27
        return $this->cache->get($key, $default);
28
    }
29 5
30
    /**
31 5
     * @inheritDoc
32
     * @throws Exception\CacheException
33
     */
34
    public function set($key, $value, $ttl = null) : bool
35
    {
36
        return $this->cache->set($key, $value, $ttl);
37
    }
38 5
39
    /**
40 5
     * @inheritDoc
41
     */
42
    public function delete($key) : bool
43
    {
44
        return $this->cache->delete($key);
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function clear() : bool
51
    {
52
        return $this->cache->clear();
53
    }
54
55
    /**
56
     * @inheritDoc
57
     * @param array|Traversable $keys
58
     */
59
    public function getMultiple($keys, $default = null) : iterable
60
    {
61
        return $this->cache->getMultiple($keys, $default);
62
    }
63 5
64
    /**
65 5
     * @inheritDoc
66
     * @param array|Traversable $values
67
     * @throws Exception\CacheException
68
     */
69
    public function setMultiple($values, $ttl = null) : bool
70
    {
71
        return $this->cache->setMultiple($values, $ttl);
72
    }
73 5
74
    /**
75 5
     * @inheritDoc
76
     * @param array|Traversable $keys
77
     */
78
    public function deleteMultiple($keys) : bool
79
    {
80
        return $this->cache->deleteMultiple($keys);
81
    }
82
83
    /**
84
     * @inheritDoc
85
     */
86
    public function has($key) : bool
87
    {
88
        return $this->cache->has($key);
89
    }
90
}
91