Fix caching & startup

This commit is contained in:
Samuele E. Locatelli
2020-08-06 20:35:50 +02:00
parent de9b335900
commit b514c771bb
3 changed files with 32 additions and 24 deletions
+25 -23
View File
@@ -1398,36 +1398,37 @@ namespace AppData
public static DS_App.StackListRow getCurrBunk()
{
DS_App.StackListRow answ = null;
DS_App.StackListDataTable tabBunk = null;
// cerco in cache....
if (cachedCurrBunk != null)
if (cachedCurrBunkTab != null)
{
answ = cachedCurrBunk;
tabBunk = cachedCurrBunkTab;
}
else
{
var tabStl = DataLayer.man.taSTL.getLoaded();
if (tabStl.Count > 0)
{
answ = tabStl[0];
}
tabBunk = DataLayer.man.taSTL.getLoaded();
// salvo in redis
cachedCurrBunk = answ;
cachedCurrBunkTab = tabBunk;
}
if (tabBunk.Count > 0)
{
answ = tabBunk[0];
}
return answ;
}
protected static DS_App.StackListRow cachedCurrBunk
protected static DS_App.StackListDataTable cachedCurrBunkTab
{
get
{
DS_App.StackListRow answ = null;
DS_App.StackListDataTable answ = null;
string rawData = memLayer.ML.getRSV(redCurrBunkTabKey());
if (!string.IsNullOrEmpty(rawData))
{
try
{
// deserializzo...
answ = JsonConvert.DeserializeObject<DS_App.StackListRow>(rawData);
answ = JsonConvert.DeserializeObject<DS_App.StackListDataTable>(rawData);
}
catch
{ }
@@ -1468,38 +1469,39 @@ namespace AppData
DS_App.SheetListRow answ = null;
if (BatchID > 0)
{
DS_App.SheetListDataTable tabSheets = null;
// cerco in cache....
if (cachedCurrSheet != null)
if (cachedCurrSheetTab != null)
{
answ = cachedCurrSheet;
tabSheets = cachedCurrSheetTab;
}
else
{
// recupero sheet corrente da Bunk...
DS_App.SheetListDataTable tabSheets = DataLayer.man.taSHL.getByMLStatus(BatchID, 5, 5);
if (tabSheets.Count > 0)
{
answ = tabSheets[0];
}
tabSheets = DataLayer.man.taSHL.getByMLStatus(BatchID, 5, 5);
// salvo in redis
cachedCurrSheet = answ;
cachedCurrSheetTab = tabSheets;
}
if (tabSheets.Count > 0)
{
answ = tabSheets[0];
}
}
return answ;
}
protected static DS_App.SheetListRow cachedCurrSheet
protected static DS_App.SheetListDataTable cachedCurrSheetTab
{
get
{
DS_App.SheetListRow answ = null;
DS_App.SheetListDataTable answ = null;
string rawData = memLayer.ML.getRSV(redCurrSheetTabKey());
if (!string.IsNullOrEmpty(rawData))
{
try
{
// deserializzo...
answ = JsonConvert.DeserializeObject<DS_App.SheetListRow>(rawData);
answ = JsonConvert.DeserializeObject<DS_App.SheetListDataTable>(rawData);
}
catch
{ }
@@ -1510,7 +1512,7 @@ namespace AppData
{
string rawData = JsonConvert.SerializeObject(value);
// TTL 5 sec
memLayer.ML.setRSV(redCurrSheetTabKey(), rawData, 2);
memLayer.ML.setRSV(redCurrSheetTabKey(), rawData, 5);
}
}
/// <summary>
+2
View File
@@ -15,8 +15,10 @@ namespace NKC_WF.App_Start
{
// inizializzo appConf prima di tutto il resto...
memLayer.ML.resetAppConf();
logger.lg.scriviLog("resetAppConf DONE", tipoLog.STARTUP);
// reset vocabolario
DataWrap.DW.resetVocabolario();
logger.lg.scriviLog("resetVocabolario DONE", tipoLog.STARTUP);
logger.lg.scriviLog("Completed preliminary setup AppConf execution", tipoLog.STARTUP);
}
catch (Exception exc)
+5 -1
View File
@@ -39,7 +39,11 @@ namespace NKC_WF.WebUserControls
DS_App.SheetListRow currSheet = ComLib.getCurrSheet(currBunk.BatchID);
if (currSheet != null)
{
SheetId = currSheet.SheetID;
// se variato...
if (SheetId != currSheet.SheetID)
{
SheetId = currSheet.SheetID;
}
}
}
else