XCacheDriver::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
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