namespace EgwCoreLib.Lux.Data.Services.Utils { public class CounterService : BaseServ, ICounterService { #region Public Constructors public CounterService( IConfiguration config, IConnectionMultiplexer redis, ICounterRepository repo) : base(config, redis) { _className = "Counter"; _repo = repo; } #endregion Public Constructors #region Public Methods /// public async Task> GetAllAsync(int? yearRef = null) { return await TraceAsync($"{_className}.GetAllAsync", async (activity) => { return await GetOrSetCacheAsync( $"{_redisBaseKey}:{_className}:ALL:Y{yearRef}", async () => await _repo.GetAllAsync(yearRef), FastCache ); }); } /// public async Task GetNextAsync(int yearRef, string countName) { return await TraceAsync($"{_className}.GetNextAsync", async (activity) => { return await GetOrSetCacheAsync( $"{_redisBaseKey}:{_className}:{countName}:Y{yearRef}", async () => await _repo.GetNextAsync(yearRef, countName), UltraFastCache ); }); } #endregion Public Methods #region Private Fields private readonly string _className; private readonly ICounterRepository _repo; #endregion Private Fields } }