NullStore   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 6
c 4
b 0
f 0
lcom 0
cbo 0
dl 0
loc 50
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A set() 0 4 1
A get() 0 4 1
A has() 0 4 1
A delete() 0 4 1
A flush() 0 4 1
1
<?php
2
/**
3
 * Null (fake) Store.
4
 *
5
 * @package SugiPHP.Cache
6
 * @author  Plamen Popov <[email protected]>
7
 * @license http://opensource.org/licenses/mit-license.php (MIT License)
8
 */
9
10
namespace SugiPHP\Cache;
11
12
/**
13
 * Null Store
14
 * This is actually a fake store. It is used to check your code is not breaking
15
 * if there is no other storages available, or if there is a problem with existing
16
 * ones, e.g. no space left on the server or there is no connection with Memcached.
17
 * Other use is when you wish your code to work without any caching for a while.
18
 */
19
class NullStore implements StoreInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function add($key, $value, $ttl = 0)
25
    {
26
        return false;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function set($key, $value, $ttl = 0)
33
    {
34
        return false;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function get($key)
41
    {
42
        return null;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function has($key)
49
    {
50
        return false;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function delete($key)
57
    {
58
        //
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function flush()
65
    {
66
        //
67
    }
68
}
69