From daf6a9b731f5b82238a8ca007500e9d94aec5322 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 11 Dec 2015 22:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3S=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/base.php b/base.php index 95b27a18..2c576d1d 100644 --- a/base.php +++ b/base.php @@ -278,24 +278,19 @@ function cookie($name, $value = '') */ function S($name, $value = '', $options = null) { - static $cache = null; if (is_array($options)) { // 缓存操作的同时初始化 - $cache = think\Cache::connect($options); + think\Cache::connect($options); } elseif (is_array($name)) { // 缓存初始化 - $cache = think\Cache::connect($name); - return $cache; - } elseif (is_null($cache)) { - // 自动初始化 - $cache = think\Cache::connect(); + return think\Cache::connect($name); } if ('' === $value) { // 获取缓存 - return $cache->get($name); + return think\Cache::get($name); } elseif (is_null($value)) { // 删除缓存 - return $cache->rm($name); + return $think\Cache::rm($name); } else { // 缓存数据 if (is_array($options)) { @@ -303,7 +298,7 @@ function S($name, $value = '', $options = null) } else { $expire = is_numeric($options) ? $options : null; //默认快捷缓存设置过期时间 } - return $cache->set($name, $value, $expire); + return think\Cache::set($name, $value, $expire); } }