| 1234567891011121314151617181920212223 |
- using Application.Abstractions.Cache;
- using Application.Abstractions.Data;
- using Domain.Entities.Common;
- using Microsoft.EntityFrameworkCore;
- namespace Application.Helpers;
- /// <summary>
- /// Config 엔티티 내 ChatExp 그룹 로더. Redis 캐시 → MSSQL 폴백.
- /// 관리자 수정 시 CacheKeys.Config 를 무효화하면 자동 갱신됨.
- /// </summary>
- public static class ChatExpConfigLoader
- {
- public static async Task<ChatExpConfig> GetAsync(ICacheService cache, IAppDbContext db, CancellationToken ct)
- {
- // 현재 Config 캐시는 AccountConfig 중심이라 여기서는 DB 폴백 우선 (필요 시 추후 캐시 계층 공유).
- var entity = await db.Config.AsNoTracking()
- .OrderByDescending(x => x.ID)
- .FirstOrDefaultAsync(ct);
- return entity?.ChatExp ?? new ChatExpConfig();
- }
- }
|