Completed
Push — master ( fbb370...38e670 )
by Alexander
05:52
created

NullCache::clear()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Yiisoft\Cache;
3
4
use Yiisoft\Cache\Dependency\Dependency;
5
6
/**
7
 * NullCache does not cache anything reporting success for all methods calls.
8
 *
9
 * By replacing it with some other cache component, one can quickly switch from
10
 * non-caching mode to caching mode.
11
 */
12
final class NullCache implements CacheInterface
13
{
14 1
    public function add($key, $value, $ttl = 0, Dependency $dependency = null): bool
15
    {
16 1
        return true;
17
    }
18
19 1
    public function deleteMultiple($keys): bool
20
    {
21 1
        return true;
22
    }
23
24 1
    public function set($key, $value, $ttl = null, Dependency $dependency = null): bool
25
    {
26 1
        return true;
27
    }
28
29 1
    public function get($key, $default = null)
30
    {
31 1
        return $default;
32
    }
33
34 1
    public function getMultiple($keys, $default = null): iterable
35
    {
36 1
        return array_fill_keys($keys, $default);
37
    }
38
39 1
    public function setMultiple($values, $ttl = null, Dependency $dependency = null): bool
40
    {
41 1
        return true;
42
    }
43
44 1
    public function addMultiple(array $values, $ttl = null, Dependency $dependency = null): bool
45
    {
46 1
        return true;
47
    }
48
49 1
    public function getOrSet($key, callable $callable, $ttl = null, Dependency $dependency = null)
50
    {
51 1
        return $callable($this);
52
    }
53
54 1
    public function delete($key): bool
55
    {
56 1
        return true;
57
    }
58
59 1
    public function clear(): bool
60
    {
61 1
        return true;
62
    }
63
64 1
    public function has($key): bool
65
    {
66 1
        return false;
67
    }
68
}
69