refresh fermate
This commit is contained in:
@@ -161,6 +161,80 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco EVENTI validi x macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<vSelEventiBCodeModel> AnagEventiGetByMacch(string IdxMacch)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch");
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
|
||||
// cerco in redisConn...
|
||||
string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.AnagEventiGetByMacc(IdxMacch);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<vSelEventiBCodeModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", result.Count);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco EVENTI validi x ogni macchina secondo conf standard macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<vSelEventiBCodeModel> AnagEventiGeneral()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("AnagEventiGeneral");
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
|
||||
// cerco in redisConn...
|
||||
string currKey = $"{Utils.redisEventList}:VSEB:GENERAL";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.AnagEventiGeneral();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<vSelEventiBCodeModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"AnagEventiGeneral | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", result.Count);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete record AnagraficaGruppi
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user