From 040ca4cb206e7fc5ffb293e3be1f85598c1406f4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 11 Feb 2016 09:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Test=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8?= 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/File.php | 1 - library/think/cache/driver/Lite.php | 16 +++--- library/think/cache/driver/Memcache.php | 2 - library/think/cache/driver/Memcached.php | 2 - library/think/cache/driver/Sae.php | 2 - library/think/cache/driver/Test.php | 67 ++++++++++++++++++++++++ library/think/cache/driver/Wincache.php | 2 - 8 files changed, 76 insertions(+), 23 deletions(-) create mode 100644 library/think/cache/driver/Test.php diff --git a/library/think/cache/driver/Apc.php b/library/think/cache/driver/Apc.php index cc97bd09..9087c11c 100644 --- a/library/think/cache/driver/Apc.php +++ b/library/think/cache/driver/Apc.php @@ -31,9 +31,7 @@ class Apc ******************************/ /** * 架构函数 - * * @param array $options 缓存参数 - * * @throws Exception * @access public */ @@ -97,11 +95,10 @@ class Apc return $result; } - /**删除缓存 + /** + * 删除缓存 * @access public - * * @param string $name 缓存变量名 - * * @return bool|\string[] */ public function rm($name) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 698bfcee..533a4634 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -182,7 +182,6 @@ class File /** * 清除缓存 * @access public - * @param string $name 缓存变量名 * @return boolean */ public function clear() diff --git a/library/think/cache/driver/Lite.php b/library/think/cache/driver/Lite.php index 6d52b951..3dc5e4f5 100644 --- a/library/think/cache/driver/Lite.php +++ b/library/think/cache/driver/Lite.php @@ -66,7 +66,7 @@ class Lite if (is_file($filename)) { // 判断是否过期 $mtime = filemtime($filename); - if ($mtimeoptions['expire']; } // 模拟永久 - if (0===$expire) { - $expire = 10*365*24*3600; + if (0 === $expire) { + $expire = 10 * 365 * 24 * 3600; } $filename = $this->filename($name); // 缓存数据 @@ -103,12 +101,12 @@ class Lite $dir = dirname($filename); // 目录不存在则创建 if (!is_dir($dir)) - mkdir($dir,0755,true); - */ + mkdir($dir,0755,true); + */ $ret = file_put_contents($filename, (" +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\Cache; + +/** + * 测试缓存类 + * @author liu21st + */ +class Test +{ + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @return mixed + */ + public function get($name) + { + return false; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int $expire 有效时间 0为永久 + * @return boolean + */ + public function set($name, $value, $expire = null) + { + return true; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + return true; + } + + /** + * 清除缓存 + * @access public + * @return boolean + */ + public function clear() + { + return true; + } +} diff --git a/library/think/cache/driver/Wincache.php b/library/think/cache/driver/Wincache.php index 397f58da..491c6c29 100644 --- a/library/think/cache/driver/Wincache.php +++ b/library/think/cache/driver/Wincache.php @@ -29,9 +29,7 @@ class Wincache /** * 架构函数 - * * @param array $options 缓存参数 - * * @throws Exception * @access public */