优化自动缓存追加;

This commit is contained in:
2022-04-23 12:59:33 +08:00
parent e35f068601
commit 820fe85dc9

View File

@@ -37,15 +37,22 @@ class BaseModel extends Model
}
public static function autoRemoveCache($model)
{
static::$autoCache[] = [
'name' => 'table',
'type' => 'tag'
];
if(!isset(static::$autoCache['table'])){
static::$autoCache['table'] = [
'name' => 'table',
'type' => 'tag'
];
}
if(!isset(static::$autoCache['read'])){
static::$autoCache['read'] = [
'name' => 'read',
'field' => 'id'
];
}
static::$autoCache[] = [
'name' => 'read',
'field' => 'id'
];
foreach (static::$autoCache as $cache_item) {
$type = $cache_item['type'] ?? 'key';