修复 APCu

This commit is contained in:
Discuz! 2017-02-04 11:47:53 +08:00
parent 0ba78f6b31
commit 3a0abdf043
1 changed files with 26 additions and 30 deletions

View File

@ -7,45 +7,41 @@
* $Id: memory_driver_apc.php 27635 2012-02-08 06:38:31Z zhangguosheng $ * $Id: memory_driver_apc.php 27635 2012-02-08 06:38:31Z zhangguosheng $
*/ */
if (!defined('IN_DISCUZ')) { if (!defined('IN_DISCUZ')) {
exit('Access Denied'); exit('Access Denied');
} }
class memory_driver_apcu { class memory_driver_apcu {
public function init($config) { public function init($config) {
}
} public function get($key) {
return apcu_fetch($key);
}
public function get($key) { public function getMulti($keys) {
return apcu_fetch($key); return apcu_fetch($key);
} }
public function getMulti($keys) { public function set($key, $value, $ttl = 0) {
$result = array(); return apcu_store($key, $value, $ttl);
foreach($keys as $key) { }
$result[$key] = apcu_fetch($key);
}
return $result;
}
public function set($key, $value, $ttl = 0) { public function rm($key) {
return apcu_store($key, $value, $ttl); return apcu_delete($key);
} }
public function rm($key) { public function clear() {
return apcu_delete($key); return apcu_clear_cache('user');
} }
public function clear() { public function inc($key, $step = 1) {
return apcu_clear_cache('user'); return apcu_inc($key, $step) !== false ? apcu_fetch($key) : false;
} }
public function inc($key, $step = 1) { public function dec($key, $step = 1) {
return apcu_inc($key, $step) !== false ? apcu_fetch($key) : false; return apcu_dec($key, $step) !== false ? apcu_fetch($key) : false;
} }
public function dec($key, $step = 1) { }
return apcu_dec($key, $step) !== false ? apcu_fetch($key) : false;
}
}