feat(RouterService): 改造 AddRouters 写入后同步更新缓存
在 BaseDal.AddData 后重新查询全量路由并写入对应类型的缓存,
使用 AddOrUpdate 方法(适配 ICacheService 接口)。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| | |
| | | |
| | | // 添加新的路由信息 |
| | | BaseDal.AddData(routers); |
| | | |
| | | // 重新查询全量路由(此时才包含新增的路由),再写入缓存 |
| | | List<Dt_Router> updatedRouters = BaseDal.QueryData(x => x.InOutType == routerType); |
| | | string cacheKey = $"Router:AllRouters:{(routerType == RouterInOutType.In.ObjToInt() ? "In" : "Out")}"; |
| | | _cacheService.AddOrUpdate(cacheKey, updatedRouters); |
| | | |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |