From c8a5a03cf49cc35bdf2fee99bb4fa262cdb72d50 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 4 Jan 2016 17:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=A9=B1=E5=8A=A8=E7=B1=BB?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/Apc.php | 7 ++++--- library/think/cache/driver/Db.php | 6 ++++-- library/think/cache/driver/File.php | 6 ++++-- library/think/cache/driver/Memcache.php | 5 +++-- library/think/cache/driver/Redis.php | 5 +++-- library/think/cache/driver/Sae.php | 5 +++-- library/think/cache/driver/Secache.php | 6 ++++-- library/think/cache/driver/Simple.php | 6 ++++-- library/think/cache/driver/Sqlite.php | 5 +++-- library/think/cache/driver/Wincache.php | 5 +++-- library/think/cache/driver/Xcache.php | 5 +++-- 11 files changed, 38 insertions(+), 23 deletions(-) diff --git a/library/think/cache/driver/Apc.php b/library/think/cache/driver/Apc.php index 08af81ca..a6420ae8 100644 --- a/library/think/cache/driver/Apc.php +++ b/library/think/cache/driver/Apc.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -27,7 +28,7 @@ class Apc ]; /***************************** 需要支持apc_cli模式 - ******************************/ + ******************************/ /** * 架构函数 * @@ -54,7 +55,7 @@ class Apc */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; return apc_fetch($this->options['prefix'] . $name); } @@ -68,7 +69,7 @@ class Apc */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Db.php b/library/think/cache/driver/Db.php index 69fd4b60..5dd46777 100644 --- a/library/think/cache/driver/Db.php +++ b/library/think/cache/driver/Db.php @@ -11,6 +11,8 @@ namespace think\cache\driver; +use think\Cache; + /** * 数据库方式缓存驱动 * CREATE TABLE think_cache ( @@ -55,7 +57,7 @@ class Db */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $name = $this->options['prefix'] . addslashes($name); $result = $this->handler->query('SELECT `data`,`datacrc` FROM `' . $this->options['table'] . '` WHERE `cachekey`=\'' . $name . '\' AND (`expire` =0 OR `expire`>' . time() . ') LIMIT 0,1'); if (false !== $result) { @@ -82,7 +84,7 @@ class Db */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; $data = serialize($value); $name = $this->options['prefix'] . addslashes($name); if (function_exists('gzcompress')) { diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 30435be7..367db0f2 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -11,6 +11,8 @@ namespace think\cache\driver; +use think\Cache; + /** * 文件类型缓存类 * @author liu21st @@ -96,7 +98,7 @@ class File if (!is_file($filename)) { return false; } - \think\Cache::$readTimes++; + Cache::$readTimes++; $content = file_get_contents($filename); if (false !== $content) { $expire = (int) substr($content, 8, 12); @@ -127,7 +129,7 @@ class File */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Memcache.php b/library/think/cache/driver/Memcache.php index efcb90e4..2d18799e 100644 --- a/library/think/cache/driver/Memcache.php +++ b/library/think/cache/driver/Memcache.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -63,7 +64,7 @@ class Memcache */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; return $this->handler->get($this->options['prefix'] . $name); } @@ -77,7 +78,7 @@ class Memcache */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Redis.php b/library/think/cache/driver/Redis.php index 89bc00a5..9450aa70 100644 --- a/library/think/cache/driver/Redis.php +++ b/library/think/cache/driver/Redis.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -62,7 +63,7 @@ class Redis */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; return $this->handler->get($this->options['prefix'] . $name); } @@ -76,7 +77,7 @@ class Redis */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Sae.php b/library/think/cache/driver/Sae.php index 4651d2e7..57163785 100644 --- a/library/think/cache/driver/Sae.php +++ b/library/think/cache/driver/Sae.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -56,7 +57,7 @@ class Sae */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; return $this->handler->get($_SERVER['HTTP_APPVERSION'] . '/' . $this->options['prefix'] . $name); } @@ -70,7 +71,7 @@ class Sae */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Secache.php b/library/think/cache/driver/Secache.php index a8622832..13ac9ccd 100644 --- a/library/think/cache/driver/Secache.php +++ b/library/think/cache/driver/Secache.php @@ -11,6 +11,8 @@ namespace think\cache\driver; +use think\Cache; + /** * Secache缓存驱动 * @author liu21st @@ -53,7 +55,7 @@ class Secache */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $name = $this->options['prefix'] . $name; $key = md5($name); $this->handler->fetch($key, $return); @@ -70,7 +72,7 @@ class Secache */ public function set($name, $value) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; $name = $this->options['prefix'] . $name; $key = md5($name); if ($result = $this->handler->store($key, $value)) { diff --git a/library/think/cache/driver/Simple.php b/library/think/cache/driver/Simple.php index 3f53d2d9..b8219230 100644 --- a/library/think/cache/driver/Simple.php +++ b/library/think/cache/driver/Simple.php @@ -11,6 +11,8 @@ namespace think\cache\driver; +use think\Cache; + /** * 文件类型缓存类 * @author liu21st @@ -59,7 +61,7 @@ class Simple */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $filename = $this->filename($name); if (is_file($filename)) { return include $filename; @@ -80,7 +82,7 @@ class Simple */ public function set($name, $value) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; $filename = $this->filename($name); // 缓存数据 $dir = dirname($filename); diff --git a/library/think/cache/driver/Sqlite.php b/library/think/cache/driver/Sqlite.php index 03b970a1..254bdebc 100644 --- a/library/think/cache/driver/Sqlite.php +++ b/library/think/cache/driver/Sqlite.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -57,7 +58,7 @@ class Sqlite */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $name = $this->options['prefix'] . sqlite_escape_string($name); $sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . time() . ') LIMIT 1'; $result = sqlite_query($this->handler, $sql); @@ -82,7 +83,7 @@ class Sqlite */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; $name = $this->options['prefix'] . sqlite_escape_string($name); $value = sqlite_escape_string(serialize($value)); if (is_null($expire)) { diff --git a/library/think/cache/driver/Wincache.php b/library/think/cache/driver/Wincache.php index 8ec8b204..397f58da 100644 --- a/library/think/cache/driver/Wincache.php +++ b/library/think/cache/driver/Wincache.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -52,7 +53,7 @@ class Wincache */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $name = $this->options['prefix'] . $name; return wincache_ucache_exists($name) ? wincache_ucache_get($name) : false; } @@ -67,7 +68,7 @@ class Wincache */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; } diff --git a/library/think/cache/driver/Xcache.php b/library/think/cache/driver/Xcache.php index e61343e2..5cca03ac 100644 --- a/library/think/cache/driver/Xcache.php +++ b/library/think/cache/driver/Xcache.php @@ -11,6 +11,7 @@ namespace think\cache\driver; +use think\Cache; use think\Exception; /** @@ -49,7 +50,7 @@ class Xcache */ public function get($name) { - \think\Cache::$readTimes++; + Cache::$readTimes++; $name = $this->options['prefix'] . $name; if (xcache_isset($name)) { return xcache_get($name); @@ -67,7 +68,7 @@ class Xcache */ public function set($name, $value, $expire = null) { - \think\Cache::$writeTimes++; + Cache::$writeTimes++; if (is_null($expire)) { $expire = $this->options['expire']; }