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_wincache.php 31432 2012-08-28 03:04:18Z 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_wincache {
|
2016-12-15 08:20:54 -05:00
|
|
|
|
2017-02-07 23:41:58 -05:00
|
|
|
public $cacheName = 'WinCache';
|
|
|
|
public $enable;
|
|
|
|
|
|
|
|
public function env() {
|
|
|
|
return function_exists('wincache_ucache_meminfo') && wincache_ucache_meminfo();
|
|
|
|
}
|
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 wincache_ucache_get($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMulti($keys) {
|
|
|
|
return wincache_ucache_get($keys);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set($key, $value, $ttl = 0) {
|
|
|
|
return wincache_ucache_set($key, $value, $ttl);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rm($key) {
|
|
|
|
return wincache_ucache_delete($key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clear() {
|
|
|
|
return wincache_ucache_clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function inc($key, $step = 1) {
|
|
|
|
return wincache_ucache_inc($key, $step);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dec($key, $step = 1) {
|
|
|
|
return wincache_ucache_dec($key, $step);
|
|
|
|
}
|
|
|
|
|
2017-02-12 22:43:46 -05:00
|
|
|
}
|