AbstractCache::clean()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Bouncer package.
5
 *
6
 * (c) François Hodierne <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bouncer\Cache;
13
14
/**
15
 * Base Cache class providing the Cache structure
16
 *
17
 * @author François Hodierne <[email protected]>
18
 */
19
abstract class AbstractCache implements CacheInterface
20
{
21
22
    protected $prefix = 'bouncer';
23
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function clean()
28
    {
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function flush()
35
    {
36
    }
37
38
    /**
39
     * Return an Identity object from cache
40
     *
41
     * @param string $id identifier for the identity
42
     *
43
     * @return object|null
44
     */
45
    public function getIdentity($id)
46
    {
47
        return $this->get("{$this->prefix}_identity_{$id}");
48
    }
49
50
    /**
51
     * Store an Identity object in cache
52
     *
53
     * @param string $id        identifier for the identity
54
     * @param object $identity  identity object
55
     */
56
    public function setIdentity($id, $identity)
57
    {
58
        return $this->set("{$this->prefix}_identity_{$id}", $identity, 60 * 60 * 6);
59
    }
60
61
    /**
62
     * Remove an Identity object from cache
63
     *
64
     * @param string $id        identifier for the identity
65
     */
66
    public function deleteIdentity($id)
67
    {
68
        return $this->delete("{$this->prefix}_identity_{$id}");
69
    }
70
71
}
72