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

89 lines
3.1 KiB
C#

//namespace Atomx.Data.CacheServices
//{
// public partial interface ICacheService
// {
// /// <summary>
// /// 获取所有可用的支付通道
// /// </summary>
// /// <returns></returns>
// Task<List<PaymentChannel>> GetPaymentChannels(List<PaymentChannel>? languages = null);
// /// <summary>
// /// 通过ID获取或更新缓存
// /// </summary>
// /// <param name="id"></param>
// /// <param name="data"></param>
// /// <returns></returns>
// Task<PaymentChannel> GetPaymentChannelById(long id, PaymentChannel? data = null);
// /// <summary>
// /// 通过ID 删除
// /// </summary>
// /// <param name="id"></param>
// /// <param name="data"></param>
// /// <returns></returns>
// Task RemovePaymentChannelById(long id);
// }
// public partial class CacheService : ICacheService
// {
// public async Task<PaymentChannel> GetPaymentChannelById(long id, PaymentChannel? data = null)
// {
// var cacheData = await GetPaymentChannels();
// if (data != null)
// {
// var language = cacheData.SingleOrDefault(p => p.Id == id);
// if (language != null)
// {
// cacheData.Remove(language);
// cacheData.Add(data);
// await SetCacheAsync(CacheKeys.PaymentChannels, cacheData);
// }
// else
// {
// cacheData.Add(data);
// await SetCacheAsync(CacheKeys.PaymentChannels, cacheData);
// }
// return data;
// }
// else
// {
// var manufacturer = cacheData.SingleOrDefault(p => p.Id == id);
// if (manufacturer != null)
// {
// return manufacturer;
// }
// return new PaymentChannel();
// }
// }
// public async Task<List<PaymentChannel>> GetPaymentChannels(List<PaymentChannel>? languages = null)
// {
// var cacheData = await GetCacheAsync<List<PaymentChannel>>(CacheKeys.PaymentChannels);
// if (languages != null)
// {
// cacheData = languages;
// await SetCacheAsync(CacheKeys.PaymentChannels, cacheData);
// }
// if (cacheData == null)
// {
// return new List<PaymentChannel>();
// }
// return cacheData;
// }
// public async Task RemovePaymentChannelById(long id)
// {
// var cacheData = await GetPaymentChannels();
// if (cacheData != null)
// {
// var data = cacheData.SingleOrDefault(p => p.Id == id);
// if (data != null)
// {
// cacheData.Remove(data);
// await SetCacheAsync(CacheKeys.PaymentChannels, cacheData);
// }
// }
// }
// }
//}