完成自动缓存和缓存清理;

This commit is contained in:
2022-02-13 12:44:17 +08:00
parent bc828f73e0
commit c4ac0764b9
5 changed files with 9 additions and 6 deletions

View File

@@ -39,11 +39,11 @@ trait AutoClearCache
{
foreach (static::$autoClearCache as $cache_item) {
$type = $cache_item['type'] ?: 'key';
$type = $cache_item['type'] ?? 'key';
$field = $cache_item['field'] ?: '';
$field = $cache_item['field'] ?? '';
$cache_key = $cache_item['name'] ?: '';
$cache_key = $cache_item['name'] ?? '';
if (empty($cache_key)) {
continue;
@@ -56,7 +56,7 @@ trait AutoClearCache
}
if ($type == 'key') {
Cache::delete($type);
Cache::delete($cache_key);
} else {
Cache::tag($cache_key)->clear();
}