diff --git a/app/common/model/BaseModel.php b/app/common/model/BaseModel.php index c7fea05..279201b 100644 --- a/app/common/model/BaseModel.php +++ b/app/common/model/BaseModel.php @@ -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';