Aggiunto retrieve dati (da convertire x grafico)
This commit is contained in:
@@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Services.Utils
|
||||
{
|
||||
public class StatsDetailService : BaseServ, IStatsDetailService
|
||||
@@ -43,11 +44,12 @@ namespace MP.Data.Services.Utils
|
||||
}
|
||||
return await GetOrSetCacheAsync(
|
||||
cacheKey,
|
||||
async () => await _repo.GetFiltAsync(dtStart, dtEnd),
|
||||
UltraLongCache
|
||||
async () => await _repo.GetFiltAsync(dtStart, dtEnd, sDest, sType),
|
||||
LongCache
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<StatsDetailModel>> GetParetoAsync(DateTime dtStart, DateTime dtEnd, int maxRec, string sDest = "", string sType = "")
|
||||
{
|
||||
@@ -65,7 +67,7 @@ namespace MP.Data.Services.Utils
|
||||
return await GetOrSetCacheAsync(
|
||||
cacheKey,
|
||||
async () => await _repo.GetParetoAsync(dtStart, dtEnd, maxRec, sDest, sType),
|
||||
UltraLongCache
|
||||
LongCache
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -83,6 +85,42 @@ namespace MP.Data.Services.Utils
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<DtUtils.Periodo> GetRangeAsync(string sEnvir, string sType)
|
||||
{
|
||||
return await TraceAsync($"{_className}.GetRange", async (activity) =>
|
||||
{
|
||||
return await GetOrSetCacheAsync(
|
||||
$"{_redisBaseKey}:{_className}:Range:{sEnvir}:{sType}",
|
||||
async () => await _repo.GetRangeAsync(sEnvir, sType),
|
||||
UltraFastCache
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> UpsertManyAsync(List<StatsDetailModel> listRecords, bool removeOld)
|
||||
{
|
||||
return await TraceAsync($"{_className}.UpsertMany", async (activity) =>
|
||||
{
|
||||
string operation = "UpsertMany";
|
||||
var success = await _repo.UpsertManyAsync(listRecords, removeOld);
|
||||
|
||||
activity?.SetTag("db.operation", operation);
|
||||
|
||||
if (success > 0)
|
||||
{
|
||||
await ClearCacheAsync($"{_redisBaseKey}:{_className}:*");
|
||||
}
|
||||
|
||||
return success;
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// metodo locale per recupero e trasformazione dati da includere con processo generare di tracking & cache
|
||||
/// </summary>
|
||||
@@ -154,39 +192,7 @@ namespace MP.Data.Services.Utils
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<DtUtils.Periodo> GetRangeAsync(string sEnvir, string sType)
|
||||
{
|
||||
return await TraceAsync($"{_className}.GetRange", async (activity) =>
|
||||
{
|
||||
return await GetOrSetCacheAsync(
|
||||
$"{_redisBaseKey}:{_className}:Range:{sEnvir}:{sType}",
|
||||
async () => await _repo.GetRangeAsync(sEnvir, sType),
|
||||
UltraFastCache
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> UpsertManyAsync(List<StatsDetailModel> listRecords, bool removeOld)
|
||||
{
|
||||
return await TraceAsync($"{_className}.UpsertMany", async (activity) =>
|
||||
{
|
||||
string operation = "UpsertMany";
|
||||
var success = await _repo.UpsertManyAsync(listRecords, removeOld);
|
||||
|
||||
activity?.SetTag("db.operation", operation);
|
||||
|
||||
if (success > 0)
|
||||
{
|
||||
await ClearCacheAsync($"{_redisBaseKey}:{_className}:*");
|
||||
}
|
||||
|
||||
return success;
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
|
||||
Reference in New Issue
Block a user