修复模板更新后不更新缓存的问题

This commit is contained in:
oldrind
2016-03-12 18:18:46 +08:00
parent 2955e89f3d
commit 95fcc59bd5
3 changed files with 49 additions and 59 deletions

View File

@@ -69,19 +69,12 @@ class Sae
/**
* 检查编译缓存是否有效
* @array $templates 用到的模板更新时间列表
* @string $cacheFile 缓存的文件名
* @int $cacheTime 缓存时间
* @return boolean
*/
public function check($templates, $cacheFile, $cacheTime)
public function check($cacheFile, $cacheTime)
{
foreach($templates as $time => $path) {
if (is_file($path) && filemtime($path) > $time) {
// 模板文件如果有更新则缓存需要更新
return false;
}
}
$mtime = $this->get($cacheFile, 'mtime');
if (0 != $cacheTime && time() > $mtime + $cacheTime) {
// 缓存是否在有效期