Files
Atomx/Atomx.Data/CacheServices/StoreCacheService.cs
2025-12-02 13:10:10 +08:00

67 lines
2.0 KiB
C#

//using Atomx.Common.Entities;
//namespace Atomx.Data.CacheServices
//{
// public partial interface ICacheService
// {
// /// <summary>
// /// 通过用户ID获取店铺信息
// /// </summary>
// /// <param name="uid"></param>
// /// <returns></returns>
// Task<Store?> GetStore(long id);
// /// <summary>
// /// 获取店铺信息
// /// </summary>
// /// <param name="id"></param>
// /// <param name="store"></param>
// /// <returns></returns>
// Task<Store> GetStore(long id, Store store);
// /// <summary>
// /// 重载店铺信息
// /// </summary>
// /// <param name="id"></param>
// /// <returns></returns>
// Task ReloadStore(long id);
// }
// public partial class CacheService : ICacheService
// {
// /// <summary>
// /// 通过用户ID获取店铺信息
// /// </summary>
// /// <param name="id"></param>
// /// <returns></returns>
// public async Task<Store?> GetStore(long id)
// {
// string key = $"{CacheKeys.StorePrefix}.{id}";
// var cacheData = await GetCacheAsync<Store>(key);
// if (cacheData == null)
// {
// var store = _dbContext.Stores.SingleOrDefault(p => p.Id == id);
// cacheData = store;
// await SetCacheAsync(key, cacheData);
// }
// return cacheData;
// }
// public async Task<Store> GetStore(long id, Store store)
// {
// string key = $"{CacheKeys.StorePrefix}.{id}";
// var cacheData = await GetCacheAsync<Store>(key);
// await SetCacheAsync(key, store);
// return store;
// }
// public async Task ReloadStore(long id)
// {
// var store = _dbContext.Stores.FirstOrDefault(p => p.Id == id);
// string key = $"{CacheKeys.StorePrefix}.{id}";
// await SetCacheAsync(key, store);
// }
// }
//}