Rimozione doppie letture x blink inutilizzato in basePage
This commit is contained in:
@@ -1285,7 +1285,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
redisDb.StringSet(currKey, rawData, UltraFastCache);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
|
||||
@@ -1344,7 +1344,7 @@ namespace MP.Data.Services
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlByIdx | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"OdlByIdx | {idxOdl} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1382,28 +1382,36 @@ namespace MP.Data.Services
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ODLExpModel result = new ODLExpModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
// se vuoto esco subito...
|
||||
if (!string.IsNullOrEmpty(idxMacchina))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlCurrByMacc | {source} | {idxMacchina} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
Log.Trace("idxMacchina vuoto!");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlCurrByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1928,7 +1936,7 @@ namespace MP.Data.Services
|
||||
result = new PODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"PODL_getByKey | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"PODL_getByKey | {idxPODL} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user