cache助手函数支持 remember方法 ,用法为:

cache('?name',function(){
   return 'value';
});
或者
cache('?name','value);
This commit is contained in:
thinkphp
2016-10-25 23:15:41 +08:00
parent a3f80621b5
commit d8c25a7970

View File

@@ -365,6 +365,9 @@ if (!function_exists('cache')) {
} elseif (is_null($value)) {
// 删除缓存
return Cache::rm($name);
} elseif (0 === strpos($name, '?') && '' !== $value) {
$expire = is_numeric($options) ? $options : null;
return Cache::remember(substr($name, 1), $value, $expire);
} else {
// 缓存数据
if (is_array($options)) {