给统计缓存加版本并绑定现有基础数据/课表失效标签,同时让演示数据、人员数据写入主动清理统计缓存;不改统计口径、筛选、导出或页面结构。
This commit is contained in:
@@ -179,7 +179,7 @@ public static class AppCacheKeys
|
||||
var filterPart = filters.Length == 0
|
||||
? "all"
|
||||
: string.Join(':', filters.Select(Normalize));
|
||||
return $"statistics:{Normalize(area)}:scope:{Normalize(dataScope)}:" +
|
||||
return $"statistics:v2:{Normalize(area)}:scope:{Normalize(dataScope)}:" +
|
||||
$"college:{effectiveCollegeId?.ToString("N") ?? "all"}:{filterPart}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System.Data;
|
||||
using Jiaowu.Api.Domain.Academic;
|
||||
using Jiaowu.Api.Infrastructure.Caching;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Jiaowu.Api.Infrastructure.Persistence;
|
||||
|
||||
public sealed class DemoDataSeeder(
|
||||
AppDbContext db,
|
||||
IAppCache cache,
|
||||
ILogger<DemoDataSeeder> logger)
|
||||
{
|
||||
// MySql.EntityFrameworkCore 10 cannot type-map parameterized primitive
|
||||
@@ -47,6 +49,10 @@ public sealed class DemoDataSeeder(
|
||||
await LogSummaryAsync(cancellationToken);
|
||||
await transaction.CommitAsync(cancellationToken);
|
||||
});
|
||||
|
||||
await cache.RemoveByTagAsync(AppCacheTags.BaseData, cancellationToken);
|
||||
await cache.RemoveByTagAsync(AppCacheTags.Timetables, cancellationToken);
|
||||
await cache.RemoveByTagAsync(AppCacheTags.Analytics, cancellationToken);
|
||||
}
|
||||
|
||||
private async Task EnsureDatabaseIsEmptyAsync(CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user