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_apc.php 27635 2012-02-08 06:38:31Z 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_apc {
|
2016-12-15 08:20:54 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public $cacheName = 'APC';
|
|
|
|
public $enable;
|
2017-02-12 22:43:46 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public function env() {
|
|
|
|
return function_exists('apc_cache_info') && @apc_cache_info();
|
|
|
|
}
|
2016-12-15 08:20:54 -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 apc_fetch($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set($key, $value, $ttl = 0) {
|
|
|
|
return apc_store($key, $value, $ttl);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rm($key) {
|
|
|
|
return apc_delete($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clear() {
|
|
|
|
return apc_clear_cache('user');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function inc($key, $step = 1) {
|
|
|
|
return apc_inc($key, $step) !== false ? apc_fetch($key) : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dec($key, $step = 1) {
|
|
|
|
return apc_dec($key, $step) !== false ? apc_fetch($key) : false;
|
|
|
|
}
|
|
|
|
|
2017-02-12 22:43:46 -05:00
|
|
|
}
|