From db965e17866e3d20ac7856920d097cddf379e85b Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 15 Aug 2017 14:39:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=96=87=E4=BB=B6=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/File.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index 4d975ee0..2fa4fe70 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -112,8 +112,6 @@ class File extends Driver if (0 != $expire && $_SERVER['REQUEST_TIME'] > filemtime($filename) + $expire && !is_file($filename . '.lock')) { // 生成过期锁定文件 touch($filename . '.lock'); - // 缓存过期删除缓存文件 - $this->unlink($filename); return $default; } $content = substr($content, 20, -3); @@ -207,7 +205,12 @@ class File extends Driver */ public function rm($name) { - return $this->unlink($this->getCacheKey($name)); + $filename = $this->getCacheKey($name); + if (is_file($filename . '.lock')) { + // 解除过期锁定文件 + unlink($filename . '.lock'); + } + return $this->unlink($filename); } /**