内核更新

This commit is contained in:
2016-07-29 13:48:52 +08:00
parent 75125bb298
commit 9da53fc969
27 changed files with 770 additions and 530 deletions

View File

@@ -11,7 +11,6 @@
namespace think\cache\driver;
use think\Cache;
use think\Exception;
/**
@@ -41,16 +40,29 @@ class Wincache
}
}
/**
* 判断缓存
* @access public
* @param string $name 缓存变量名
* @return bool
*/
public function has($name)
{
$name = $this->options['prefix'] . $name;
return wincache_ucache_exists($name);
}
/**
* 读取缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $default 默认值
* @return mixed
*/
public function get($name)
public function get($name, $default = false)
{
$name = $this->options['prefix'] . $name;
return wincache_ucache_exists($name) ? wincache_ucache_get($name) : false;
return wincache_ucache_exists($name) ? wincache_ucache_get($name) : $default;
}
/**
@@ -73,6 +85,32 @@ class Wincache
return false;
}
/**
* 自增缓存(针对数值缓存)
* @access public
* @param string $name 缓存变量名
* @param int $step 步长
* @param int $expire 有效时间 0为永久
* @return false|int
*/
public function inc($name, $step = 1, $expire = null)
{
return wincache_ucache_inc($name, $step, $expire);
}
/**
* 自减缓存(针对数值缓存)
* @access public
* @param string $name 缓存变量名
* @param int $step 步长
* @param int $expire 有效时间 0为永久
* @return false|int
*/
public function dec($name, $step = 1, $expire = null)
{
return wincache_ucache_dec($name, $step, $expire);
}
/**
* 删除缓存
* @access public