Files
lux/EgwCoreLib.Lux.Data/Services/Job/PhaseService.cs
T
2026-03-20 19:03:32 +01:00

50 lines
1.3 KiB
C#

using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Repository.Job;
using Microsoft.Extensions.Configuration;
using StackExchange.Redis;
namespace EgwCoreLib.Lux.Data.Services.Job
{
public class PhaseService : BaseServ, IPhaseService
{
#region Public Constructors
public PhaseService(
IConfiguration config,
IConnectionMultiplexer redis,
IPhaseRepository repo) : base(config, redis)
{
_className = "Phase";
_repo = repo;
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Elenco completo Phase da DB
/// </summary>
/// <returns></returns>
public async Task<List<PhaseModel>> GetAllAsync()
{
return await TraceAsync($"{_className}.GetAll", async (activity) =>
{
return await GetOrSetCacheAsync(
$"{_redisBaseKey}:{_className}:ALL",
async () => await _repo.GetAllAsync(),
UltraLongCache
);
});
}
#endregion Public Methods
#region Private Fields
private readonly string _className;
private readonly IPhaseRepository _repo;
#endregion Private Fields
}
}