Aggiunto display idx di ODL/PODL
This commit is contained in:
@@ -845,7 +845,83 @@ namespace MP.SPEC.Data
|
||||
/// <returns></returns>
|
||||
public async Task<PODLModel> PODL_getByKey(int idxPODL)
|
||||
{
|
||||
return await dbController.PODL_getByKey(idxPODL);
|
||||
PODLModel result = new PODLModel();
|
||||
if (idxPODL != 0)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisPOdlByPOdl}:{idxPODL}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.PODL_getByKey(idxPODL);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new PODLModel();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Debug("Errore IdxPODL = 0");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero PODL da IdxODL
|
||||
/// </summary>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <returns></returns>
|
||||
public PODLModel PODL_getByOdl(int idxODL)
|
||||
{
|
||||
PODLModel result = new PODLModel();
|
||||
if (idxODL != 0)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisPOdlByOdl}:{idxODL}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.PODL_getByOdl(idxODL);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new PODLModel();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Debug("Errore IdxODL = 0");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1036,6 +1112,10 @@ namespace MP.SPEC.Data
|
||||
|
||||
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
|
||||
|
||||
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
|
||||
|
||||
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
|
||||
|
||||
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
|
||||
|
||||
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
|
||||
|
||||
Reference in New Issue
Block a user