From 41f7145acecc4793f920d845064c5659eb38851c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 8 Aug 2016 17:48:17 +0800 Subject: [PATCH] =?UTF-8?q?cache=E7=B1=BB=E7=9A=84init=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0=20File=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E5=8E=BB=E6=8E=89=E4=B8=8D=E5=86=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84path=5Flevel=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Cache.php | 5 +++-- library/think/cache/driver/File.php | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/library/think/Cache.php b/library/think/Cache.php index 7ae31aae..3bbd3e3a 100644 --- a/library/think/Cache.php +++ b/library/think/Cache.php @@ -58,13 +58,14 @@ class Cache /** * 自动初始化缓存 * @access public + * @param array $options 配置数组 * @return void */ - public static function init() + public static function init(array $options = []) { if (is_null(self::$handler)) { // 自动初始化缓存 - self::connect(Config::get('cache')); + self::connect($options ?: Config::get('cache')); } } diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 97ee2bf6..1f4b91f8 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -17,11 +17,9 @@ namespace think\cache\driver; */ class File { - protected $options = [ 'expire' => 0, 'cache_subdir' => false, - 'path_level' => 1, 'prefix' => '', 'path' => CACHE_PATH, 'data_compress' => false,