Yac.php
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Created by PhpStorm.
* User: liuziyang
* Date: 14-1-25
* Time: 22:52
*/
class Q_Cache_Yac
{
static private $_yac = Null;
static function isEnabled()
{
return extension_loaded('yac');
}
/**
* @return Yac
*/
static function initYac()
{
if (!extension_loaded('yac')) {
throw new Exception('没有Yac插件.');
}
if (empty(self::$_yac)) {
self::$_yac = new Yac();
}
return self::$_yac;
}
static function set($key, $value)
{
return self::initYac()->set($key, $value);
}
static function get($key)
{
return self::initYac()->get($key);
}
static function delete($key)
{
return self::initYac()->delete($key);
}
static function add($key, $val)
{
return self::initYac()->add($key, $val);
}
static function dump($int)
{
return self::initYac()->dump($int);
}
static function flush()
{
return self::initYac()->flush();
}
}