mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进文件缓存驱动的clear方法
This commit is contained in:
10
library/think/cache/driver/File.php
vendored
10
library/think/cache/driver/File.php
vendored
@@ -221,9 +221,13 @@ class File extends Driver
|
|||||||
$this->rm('tag_' . md5($tag));
|
$this->rm('tag_' . md5($tag));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$fileLsit = (array) glob($this->options['path'] . '*');
|
$files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DS : '') . '*');
|
||||||
foreach ($fileLsit as $path) {
|
foreach ($files as $path) {
|
||||||
is_file($path) && unlink($path);
|
if (is_dir($path)) {
|
||||||
|
array_map('unlink', glob($path . '/*.php'));
|
||||||
|
} else {
|
||||||
|
unlink($path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
2
library/think/cache/driver/Lite.php
vendored
2
library/think/cache/driver/Lite.php
vendored
@@ -180,6 +180,6 @@ class Lite extends Driver
|
|||||||
$this->rm('tag_' . md5($tag));
|
$this->rm('tag_' . md5($tag));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
array_map("unlink", glob($this->options['path'] . $this->options['prefix'] . '*.php'));
|
array_map("unlink", glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DS : '') . '*.php'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user