From 0a8eae4d74b77751a1b3149ee0e1fede534390b8 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 6 Jun 2022 10:01:38 +0200 Subject: [PATCH] Update salvataggio FLog su REDIS x cache rapida (recupero MON) --- MapoDb/DataLayer.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index fb4cad70..c09a312d 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -769,7 +769,18 @@ namespace MapoDb /// public static string LiveBufferHash(string idxMacchina, string bufferName) { - return mHash(string.Format("LIVE:{0}:{1}", idxMacchina, bufferName)); + return mHash($"LIVE:{idxMacchina}:{bufferName}"); + } + + /// + /// KEY x i dati del FLog della machina specificata + /// + /// + /// + /// + public static string LiveFLogKeyHash(string idxMacchina, string flog) + { + return mHash($"FLOG:{idxMacchina}:{flog}"); } /// @@ -779,7 +790,7 @@ namespace MapoDb /// public static string LiveCurrValHash(string idxMacchina) { - return mHash(string.Format("LIVE:{0}:CURR_VAL", idxMacchina)); + return mHash($"LIVE:{idxMacchina}:CURR_VAL"); } /// @@ -789,7 +800,7 @@ namespace MapoDb /// public static string memMapHash(string idxMacchina) { - return mHash(string.Format("MemMap:{0}", idxMacchina)); + return mHash($"MemMap:{idxMacchina}"); } /// @@ -2276,7 +2287,11 @@ namespace MapoDb // 2020.01.31 nuovo OBJ DataLayer man = new DataLayer(); man.taFL.InsNew(idxMacchina, dataOraEvento, flux, valore, contatore); - //DataLayer.obj.taFL.InsNew(idxMacchina, dataOraEvento, flux, valore, contatore); + // 2022.06.06 salvo su redis il valore ULTIMO del flux x recupero rapido ultimo valore + string key = DataLayer.LiveFLogKeyHash(idxMacchina, flux); + // 10 min cache max... + int ttlFlog = 60 * 10; + memLayer.ML.setRSV(key, valore, ttlFlog); // registro in risposta che รจ andato tutto bene... answ = "OK"; }