mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进文件缓存
This commit is contained in:
9
library/think/cache/driver/File.php
vendored
9
library/think/cache/driver/File.php
vendored
@@ -112,8 +112,6 @@ class File extends Driver
|
|||||||
if (0 != $expire && $_SERVER['REQUEST_TIME'] > filemtime($filename) + $expire && !is_file($filename . '.lock')) {
|
if (0 != $expire && $_SERVER['REQUEST_TIME'] > filemtime($filename) + $expire && !is_file($filename . '.lock')) {
|
||||||
// 生成过期锁定文件
|
// 生成过期锁定文件
|
||||||
touch($filename . '.lock');
|
touch($filename . '.lock');
|
||||||
// 缓存过期删除缓存文件
|
|
||||||
$this->unlink($filename);
|
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
$content = substr($content, 20, -3);
|
$content = substr($content, 20, -3);
|
||||||
@@ -207,7 +205,12 @@ class File extends Driver
|
|||||||
*/
|
*/
|
||||||
public function rm($name)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user