XCacheDriver::remove()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Millennium\Cache\Drivers;
4
5
use Millennium\Cache\Interfaces\CacheDriverInterface;
6
7
class XCacheDriver implements CacheDriverInterface
8
{
9
    public function __construct()
10
    {
11
        if (!function_exists('xcache_isset')) {
12
            throw new \Millennium\Cache\Exceptions\DriverNotFoundException('XCache not installed on your system');
13
        }
14
    }
15
16
    public function fetch($key)
17
    {
18
        if (xcache_isset($key)) {
19
            return xcache_get($key);
20
        }
21
    }
22
23
    public function remove($key)
24
    {
25
        if (xcache_isset($key)) {
26
            xcache_unset($key);
27
        }
28
    }
29
30
    public function store($key, $data, $expire = 0)
31
    {
32
        return xcache_set($key, $data, $expire);
33
    }
34
}
35