Files
Kg.SeaTime/Service/Application.Domain/Services/Service/Pub/GameDicService.cs
2026-06-17 19:22:35 +08:00

19 lines
658 B
C#

namespace Application.Domain;
public class GameDicService(ISqlSugarClient DbClient, IRedisCache redis) : IGameDicService, ITransient
{
public async Task<game_dic> GetDicInfo(string code)
{
string key = string.Format(BaseCache.BaseCacheKey, "DicData");
if (await redis.HExistsHashAsync(key, code))
{
return await redis.GetHashAsync<game_dic>(key, code);
}
var db = DbClient.AsTenant().GetConnectionWithAttr<game_dic>();
var data = await db.Queryable<game_dic>().Where(it => it.code == code).SingleAsync();
await redis.AddHashAsync(key, code, data);
return data;
}
}