2016-12-15 08:20:54 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
|
|
|
* This is NOT a freeware, use is subject to license terms
|
|
|
|
*
|
|
|
|
* $Id: memory_driver_xcache.php 27449 2012-02-01 05:32:35Z zhangguosheng $
|
|
|
|
*/
|
2017-02-07 23:41:58 -05:00
|
|
|
if (!defined('IN_DISCUZ')) {
|
2016-12-15 08:20:54 -05:00
|
|
|
exit('Access Denied');
|
|
|
|
}
|
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
class memory_driver_xcache {
|
2016-12-15 08:20:54 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public $cacheName = 'XCache';
|
|
|
|
public $enable;
|
2016-12-15 08:20:54 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public function env() {
|
|
|
|
return function_exists('xcache_get');
|
|
|
|
}
|
2017-02-12 22:43:46 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public function init($config) {
|
|
|
|
$this->enable = $this->env();
|
2016-12-15 08:20:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public function get($key) {
|
|
|
|
return xcache_get($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set($key, $value, $ttl = 0) {
|
|
|
|
return xcache_set($key, $value, $ttl);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rm($key) {
|
|
|
|
return xcache_unset($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clear() {
|
|
|
|
return xcache_clear_cache(XC_TYPE_VAR, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function inc($key, $step = 1) {
|
|
|
|
return xcache_inc($key, $step);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dec($key, $step = 1) {
|
|
|
|
return xcache_dec($key, $step);
|
|
|
|
}
|
|
|
|
|
2017-02-12 22:43:46 -05:00
|
|
|
}
|