diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj
index 7ac087f4..80f54f41 100644
--- a/MP-TAB3/MP-TAB3.csproj
+++ b/MP-TAB3/MP-TAB3.csproj
@@ -3,7 +3,7 @@
net8.0
enable
- 8.16.2605.2912
+ 8.16.2606.107
enable
MP_TAB3
diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html
index 26e66a60..2f37a84c 100644
--- a/MP-TAB3/Resources/ChangeLog.html
+++ b/MP-TAB3/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2912
+ Versione: 8.16.2606.107
Note di rilascio:
-
diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt
index a0cc7bd5..23c4c2a2 100644
--- a/MP-TAB3/Resources/VersNum.txt
+++ b/MP-TAB3/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.107
diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml
index a3dd4bc9..7af13f75 100644
--- a/MP-TAB3/Resources/manifest.xml
+++ b/MP-TAB3/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.107
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html
false
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index f76c2c99..c6af9b64 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 8.16.2605.2912
+ 8.16.2606.107
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index 71dc6693..f65472e3 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.107
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index a0cc7bd5..23c4c2a2 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.107
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index 1acbb774..812608b3 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.107
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html
false
diff --git a/MP.IOC/Data/MpDataService.cs b/MP.IOC/Data/MpDataService.cs
index f11e2a3c..7c431061 100644
--- a/MP.IOC/Data/MpDataService.cs
+++ b/MP.IOC/Data/MpDataService.cs
@@ -1645,7 +1645,7 @@ namespace MP.IOC.Data
}
else
{
- result = await SpecDbController.PODL_getByKey(idxPODL);
+ result = await SpecDbController.PODL_getByKeyAsync(idxPODL);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj
index e0764bb9..262d0290 100644
--- a/MP.IOC/MP.IOC.csproj
+++ b/MP.IOC/MP.IOC.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 8.16.2605.2912
+ 8.16.2606.107
diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html
index 7935b453..ace390ae 100644
--- a/MP.IOC/Resources/ChangeLog.html
+++ b/MP.IOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-IOC
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.107
Note di rilascio:
-
diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt
index a0cc7bd5..23c4c2a2 100644
--- a/MP.IOC/Resources/VersNum.txt
+++ b/MP.IOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.107
diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml
index 556db6a0..4d5d949a 100644
--- a/MP.IOC/Resources/manifest.xml
+++ b/MP.IOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.107
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index ba3f8cbc..22696007 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2605.2912
+ 8.16.2606.0107
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index 0db0b932..b1d044b8 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.0107
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index a0cc7bd5..189d4f36 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.0107
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 12562a96..ca810dd9 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.0107
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html
false
diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj
index aa934ba7..fedcb911 100644
--- a/MP.MON/MP.MON.csproj
+++ b/MP.MON/MP.MON.csproj
@@ -6,7 +6,7 @@
enable
MP.MON
$(AssemblyName.Replace(' ', '_'))
- 8.16.2605.2912
+ 8.16.2606.107
diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html
index 26e66a60..2f37a84c 100644
--- a/MP.MON/Resources/ChangeLog.html
+++ b/MP.MON/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2912
+ Versione: 8.16.2606.107
Note di rilascio:
-
diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt
index a0cc7bd5..23c4c2a2 100644
--- a/MP.MON/Resources/VersNum.txt
+++ b/MP.MON/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.107
diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml
index f5459cbc..f996b216 100644
--- a/MP.MON/Resources/manifest.xml
+++ b/MP.MON/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.107
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html
false
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index 0a6adc88..335a8d97 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Prog
- 8.16.2605.2912
+ 8.16.2606.0107
True
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index 66d0760d..f94200a8 100644
--- a/MP.Prog/Resources/ChangeLog.html
+++ b/MP.Prog/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo gestione Programmi MAPO
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.0107
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index a0cc7bd5..189d4f36 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.0107
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index 6fd01dd3..7d49450e 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.0107
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html
false
diff --git a/MP.RIOC/MP.RIOC.csproj b/MP.RIOC/MP.RIOC.csproj
index 00b28fa0..1b35a199 100644
--- a/MP.RIOC/MP.RIOC.csproj
+++ b/MP.RIOC/MP.RIOC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.RIOC
- 8.16.2605.2912
+ 8.16.2606.107
diff --git a/MP.RIOC/Resources/ChangeLog.html b/MP.RIOC/Resources/ChangeLog.html
index 958931c8..b843ef52 100644
--- a/MP.RIOC/Resources/ChangeLog.html
+++ b/MP.RIOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-RIOC
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.107
Note di rilascio:
-
diff --git a/MP.RIOC/Resources/VersNum.txt b/MP.RIOC/Resources/VersNum.txt
index a0cc7bd5..23c4c2a2 100644
--- a/MP.RIOC/Resources/VersNum.txt
+++ b/MP.RIOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.107
diff --git a/MP.RIOC/Resources/manifest.xml b/MP.RIOC/Resources/manifest.xml
index 0b88d126..15b83d5e 100644
--- a/MP.RIOC/Resources/manifest.xml
+++ b/MP.RIOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.107
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 71a644f0..f823395f 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -1,6 +1,5 @@
using EgwCoreLib.Utils;
using Microsoft.EntityFrameworkCore;
-using MP.Core.Conf;
using MP.Core.DTO;
using MP.Core.Objects;
using MP.Data;
@@ -85,10 +84,7 @@ namespace MP.SPEC.Data
#region Public Properties
- public static MpSpecController dbController { get; set; } = null!;
- public static MpMongoController mongoController { get; set; } = null!;
public MessagePipe BroadastMsgPipe { get; set; } = null!;
- public Dictionary> currTagConf { get; set; } = new Dictionary>();
///
/// Expiry DateTime x refresh pagina parametri
@@ -173,7 +169,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "AnagEventiGeneralAsync",
cacheKey: $"{Utils.redisEventList}:VSEB:GENERAL",
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
{
return await dbController.AnagEventiGeneralAsync() ?? new List();
@@ -224,7 +220,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "AnagStatiCommAsync",
cacheKey: Utils.redisStatoCom,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.AnagStatiCommAsync() ?? new List(),
tagList: [Utils.redisStatoCom]
@@ -240,7 +236,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "AnagTipoArtLvAsync",
cacheKey: Utils.redisTipoArt,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.AnagTipoArtLvAsync() ?? new List(),
tagList: [Utils.redisTipoArt]
);
@@ -255,25 +251,19 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ArticleWithDossierAsync",
cacheKey: Utils.redisArtByDossier,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await Task.FromResult(dbController.ArticleWithDossier()) ?? new List(),
tagList: [Utils.redisArtByDossier]
);
}
- public async Task ArticoliCountAsync()
- {
- string redisKey = $"{Utils.redisArtList}:Count";
- return await GetOrFetchAsync(
- operationName: "ArticoliCountAsync",
- cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
- fetchFunc: async () =>
- await dbController.ArticoliCountAsync(),
- tagList: [Utils.redisArtList, $"{Utils.redisArtList}:CountAll"]
- );
- }
-
+ ///
+ /// Conteggio articoli data ricerca
+ ///
+ ///
+ ///
+ ///
+ ///
public async Task ArticoliCountSearchAsync(string tipo = "*", string azienda = "*", string searchVal = "")
{
string sKey = string.IsNullOrWhiteSpace(tipo) ? "ALL" : tipo.Trim();
@@ -281,7 +271,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ArticoliCountSearchAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.ArticoliCountSearchAsync(tipo, azienda, searchVal),
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:CountSearch"]
@@ -298,7 +288,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("ArticoliDeleteRecord");
string source = "DB";
bool fatto = await dbController.ArticoliDeleteRecord(currRec);
- await FlushCacheArticoli();
+ await FlushFusionCacheArticoli();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"ArticoliDeleteRecord | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -318,7 +308,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ArticoliGetByTipoAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.ArticoliGetByTipoAsync(tipo, azienda) ?? new List(),
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:Tipo"]
@@ -340,7 +330,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ArticoliGetSearchAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.ArticoliGetSearchAsync(numRecord, tipoArt, azienda, searchVal) ?? new List(),
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:Search"]
@@ -357,7 +347,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ArticoliInKitAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.ArticoliInKitAsync() ?? new List(),
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:InKit"]
@@ -374,7 +364,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("ArticoliUpdateRecord");
string source = "DB";
bool fatto = await dbController.ArticoliUpdateRecord(currRec);
- await FlushCacheArticoli();
+ await FlushFusionCacheArticoli();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"ArticoliUpdateRecord | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -450,7 +440,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ConfigGetAllAsync",
cacheKey: Utils.redisConfAll,
- expiration: getRandTOut(redisLongTimeCache * 2),
+ expiration: GetRandTOut(redisLongTimeCache * 2),
fetchFunc: async () => await dbController.ConfigGetAllAsync() ?? new List(),
tagList: [Utils.redisConfAll]
);
@@ -464,7 +454,7 @@ namespace MP.SPEC.Data
{
using var activity = ActivitySource.StartActivity("ConfigResetCacheAsync");
string source = "REDIS";
- await FlushCacheConfig();
+ await FlushFusionCacheConfig();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"ConfigResetCacheAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -502,7 +492,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("ConfigUpdateAsync");
string source = "DB";
var updRes = await dbController.ConfigUpdateAsync(updRec);
- await FlushCacheConfig();
+ await FlushFusionCacheConfig();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"ConfigUpdateAsync Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -578,7 +568,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "DossiersGetLastFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache * 5),
+ expiration: GetRandTOut(redisLongTimeCache * 5),
fetchFunc: async () => await dbController.DossiersGetLastFiltAsync(IdxMacchina, CodArticolo, DtStart, DtEnd, MaxRec) ?? new List(),
tagList: [Utils.redisDossByMac]
);
@@ -652,7 +642,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ElencoAziendeAsync",
cacheKey: $"{Utils.redisAnagGruppi}:Aziende",
- expiration: getRandTOut(redisLongTimeCache * 2),
+ expiration: GetRandTOut(redisLongTimeCache * 2),
fetchFunc: async () =>
await dbController.AnagGruppiAziendeAsync() ?? new List(),
tagList: [Utils.redisAnagGruppi, $"{Utils.redisAnagGruppi}:Aziende"]
@@ -668,7 +658,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ElencoGruppiFaseAsync",
cacheKey: $"{Utils.redisAnagGruppi}:FASE",
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.AnagGruppiFaseAsync() ?? new List(),
tagList: [Utils.redisAnagGruppi]
);
@@ -683,7 +673,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ElencoLinkAsync",
cacheKey: Utils.redisLinkMenu,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.ElencoLinkAsync() ?? new List(),
tagList: [Utils.redisLinkMenu]
);
@@ -698,7 +688,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ElencoRepartiDtoAsync",
cacheKey: $"{Utils.redisAnagGruppi}:REPARTO",
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.AnagGruppiRepartoDtoAsync() ?? new(),
tagList: [Utils.redisAnagGruppi]
);
@@ -759,52 +749,6 @@ namespace MP.SPEC.Data
return result;
}
- ///
- /// Esegue flush memoria redis dato keyVal, async
- ///
- ///
- ///
- public async Task ExecFlushRedisPatternAsync(RedisValue pat2Flush)
- {
- bool answ = false;
- using var activity = ActivitySource.StartActivity("ExecFlushRedisPatternAsync");
- string source = "REDIS";
- var masterEndpoint = redisConn.GetEndPoints()
- .Where(ep => redisConn.GetServer(ep).IsConnected && !redisConn.GetServer(ep).IsReplica)
- .FirstOrDefault();
-
- // sepattern è "*" elimino intero DB...
- if (masterEndpoint != null && (pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
- {
- redisConn.GetServer(masterEndpoint).FlushDatabase(database: redisDb.Database);
- }
- else
- {
- var server = redisConn.GetServer(masterEndpoint);
- var keys = server.Keys(database: redisDb.Database, pattern: pat2Flush, pageSize: 1000);
-
- var deleteTasks = new List();
- foreach (var key in keys)
- {
- deleteTasks.Add(redisDb.KeyDeleteAsync(key));
- if (deleteTasks.Count >= 1000)
- {
- await Task.WhenAll(deleteTasks);
- deleteTasks.Clear();
- }
- }
- if (deleteTasks.Count > 0)
- {
- await Task.WhenAll(deleteTasks);
- }
- }
- answ = true;
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"ExecFlushRedisPatternAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
///
/// Flush cache relativa a MP-IO x dati ODL
///
@@ -842,7 +786,7 @@ namespace MP.SPEC.Data
// effettuo merge statistiche...
await ProcDedupStatMergeAsync(procStats);
// svuoto cache
- await FlushCacheFluxLog();
+ await FlushFusionCacheFluxLog();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"FluxLogDataReduxAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -908,7 +852,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "FluxLogParetoAsync",
cacheKey: redKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.FluxLogParetoAsync(idxMacchina, dtFrom, dtTo) ?? new List(),
tagList: [Utils.redisParetoFLKey]
);
@@ -930,7 +874,7 @@ namespace MP.SPEC.Data
string source = "DB";
await dbController.ForceDbMaint(doExec, doUpdStat, doSave, minPgCnt, minAvgFrag, maxAvgFragReb);
// svuoto cache
- await FlushCacheFluxLog();
+ await FlushFusionCacheFluxLog();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"ForceDbMaint | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -947,6 +891,10 @@ namespace MP.SPEC.Data
return FlushFusionCacheAsync();
}
+ ///
+ /// Cancellazione RedisCache forzata
+ ///
+ ///
public async Task ForceFlushRedisCache()
{
using var activity = ActivitySource.StartActivity("ForceFlushRedisCache");
@@ -972,7 +920,7 @@ namespace MP.SPEC.Data
bool result = false;
result = await dbController.Grp2MaccDeleteAsync(rec2del);
// elimino cache redis...
- await FlushCacheMacGrp();
+ await FlushFusionCacheMacGrp();
activity?.SetTag("data.source", "DB");
activity?.Stop();
LogTrace($"Grp2MaccDeleteAsync | CodGruppo {rec2del.CodGruppo} | IdxMacc {rec2del.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
@@ -990,7 +938,7 @@ namespace MP.SPEC.Data
bool result = false;
result = await dbController.Grp2MaccInsertAsync(upsRec);
// elimino cache redis...
- await FlushCacheMacGrp();
+ await FlushFusionCacheMacGrp();
activity?.SetTag("data.source", "DB");
activity?.Stop();
LogTrace($"Grp2MaccInsertAsync | CodGruppo {upsRec.CodGruppo} | IdxMacc {upsRec.IdxMacchina} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1008,7 +956,7 @@ namespace MP.SPEC.Data
bool result = false;
result = await dbController.Grp2OperDeleteAsync(rec2del);
// elimino cache redis...
- await FlushCacheOprGrp();
+ await FlushFusionCacheOprGrp();
activity?.SetTag("data.source", "DB");
activity?.Stop();
LogTrace($"Grp2OperDeleteAsync | CodGruppo {rec2del.CodGruppo} | MatrOpr {rec2del.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1026,7 +974,7 @@ namespace MP.SPEC.Data
bool result = false;
result = await dbController.Grp2OperInsertAsync(upsRec);
// elimino cache redis...
- await FlushCacheOprGrp();
+ await FlushFusionCacheOprGrp();
activity?.SetTag("data.source", "DB");
activity?.Stop();
LogTrace($"Grp2OperInsertAsync | CodGruppo {upsRec.CodGruppo} | MatrOpr {upsRec.MatrOpr} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1056,7 +1004,7 @@ namespace MP.SPEC.Data
// salvo
bool fatto = await dbController.IstKitDeleteAsync(currRecord);
// svuoto cache
- await FlushKitCache();
+ await FlushFusionCacheKit();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"IstKitDeleteAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1075,7 +1023,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "IstKitFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.IstKitFiltAsync(keyKit, keyExtOrd) ?? new List(),
tagList: [Utils.redisKitInst]
);
@@ -1093,7 +1041,7 @@ namespace MP.SPEC.Data
// salvo
bool fatto = await dbController.IstKitInsertByWKSAsync(CodArtParent, KeyFilt);
// svuoto cache
- await FlushKitCache();
+ await FlushFusionCacheKit();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"IstKitInsertByWKSAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1111,7 +1059,7 @@ namespace MP.SPEC.Data
// salvo
bool fatto = await dbController.IstKitUpsertAsync(currRecord);
// svuoto cache
- await FlushKitCache();
+ await FlushFusionCacheKit();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"IstKitUpsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1129,7 +1077,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ListGiacenzeAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.ListGiacenzeAsync(IdxOdl) ?? new List(),
tagList: [Utils.redisGiacenzaList]
);
@@ -1148,7 +1096,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ListPODL_ByCodArtAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.ListPODL_ByCodArtAsync(CodArticolo, OnlyAvail) ?? new(),
tagList: [Utils.redisPOdlByCodArt]
);
@@ -1167,7 +1115,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MacchineGetFiltAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.MacchineGetFiltAsync(codGruppo)
?? new List(),
@@ -1186,7 +1134,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MacchineRecipeArchiveAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
{
var machineList = await MacchineGetFiltAsync("*");
@@ -1208,7 +1156,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MacchineRecipeConfAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
{
var machineList = await MacchineGetFiltAsync("*");
@@ -1231,7 +1179,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MacchineWithFluxAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.MacchineWithFluxAsync(dtStart, dtEnd) ?? new List(),
tagList: [Utils.redisMacByFlux]
);
@@ -1244,7 +1192,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MachineWithOdlAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () =>
{
var rawData = await dbController.OdlGetCurrentAsync();
@@ -1270,12 +1218,12 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "MachIobConfAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () =>
{
Dictionary result = new Dictionary();
// cerco in redis...
- string currKey = redHashMpIO($"IOB:{IdxMacchina}:MachIobConfAsync");
+ string currKey = RedHashMpIO($"IOB:{IdxMacchina}:MachIobConfAsync");
if (await redisDb.KeyExistsAsync(currKey))
{
result = (await redisDb.HashGetAllAsync(currKey))
@@ -1332,7 +1280,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "OdlByBatchAsync",
cacheKey: Utils.redisOdlByBatch,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.OdlByBatchAsync(BatchSel),
tagList: [Utils.redisOdlByBatch]
);
@@ -1349,7 +1297,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "OdlByKeyAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.OdlByKeyAsync(IdxOdl),
tagList: [Utils.redisOdlByKey]
);
@@ -1409,7 +1357,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "OdlListGetFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.ListODLFiltAsync(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate) ?? new(),
tagList: [Utils.redisOdlList]
);
@@ -1426,7 +1374,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "OdlStatsAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.OdlGetStatAsync(IdxOdl) ?? new(),
tagList: [Utils.redisOdlStats]
);
@@ -1445,7 +1393,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "OperatoriGetFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.OperatoriGetFiltAsync(codGruppo) ?? new List(),
tagList: [Utils.redisOprList]
);
@@ -1462,7 +1410,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "ParametriGetFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.ParametriGetFiltAsync(IdxMacchina) ?? new(),
tagList: [Utils.redisFluxByMac]
);
@@ -1548,7 +1496,7 @@ namespace MP.SPEC.Data
string source = "DB+REDIS";
var dbResult = await dbController.PODLDeleteRecord(currRec);
// elimino cache redis...
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"POdlDeleteRecord | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1566,7 +1514,7 @@ namespace MP.SPEC.Data
string source = "DB+REDIS";
var dbResult = await dbController.PODL_startSetup(currRec, 0, 1, 1, "", DateTime.Now);
// elimino cache redis...
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"POdlDoSetup | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1618,7 +1566,7 @@ namespace MP.SPEC.Data
// salvo
fatto = await dbController.PodlIstKitDeleteAsync(IdxPODL);
// svuoto cache
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", "DB");
return fatto;
}
@@ -1634,7 +1582,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "POdlListByKitParentAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.ListPODL_ByKitParentAsync(IdxPodlParent) ?? new(),
tagList: [Utils.redisPOdlList]
);
@@ -1656,7 +1604,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "POdlListGetFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisShortTimeCache),
+ expiration: GetRandTOut(redisShortTimeCache),
fetchFunc: async () => await dbController.ListPODLFiltAsync(lanciato, keyRichPart, idxMacchina, codGruppo, startDate, endDate) ?? new List(),
tagList: [Utils.redisPOdlList]
);
@@ -1679,7 +1627,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "POdlToKitListGetFiltAsync",
cacheKey: redisKey,
- expiration: getRandTOut(redisShortTimeCache * 5),
+ expiration: GetRandTOut(redisShortTimeCache * 5),
fetchFunc: async () =>
await dbController.ListPODL_KitFiltAsync(
lanciato,
@@ -1706,7 +1654,7 @@ namespace MP.SPEC.Data
bool answ = false;
answ = await dbController.PODL_updateRecipe(idxPODL, recipeName);
// reset redis...
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"POdlUpdateRecipe | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1724,7 +1672,7 @@ namespace MP.SPEC.Data
string source = "DB";
var dbResult = await dbController.PODLUpdateRecordAsync(currRec);
// elimino cache redis...
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"POdlUpdateRecord | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1785,7 +1733,7 @@ namespace MP.SPEC.Data
string source = "MONGO";
bool answ = false;
answ = await mongoController.RecipeSetByPODL(currRecord);
- await FlushCachePOdl();
+ await FlushFusionCachePOdl();
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"RecipeSetByPODL | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
@@ -1885,7 +1833,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "StatoMacchinaAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.StatoMacchinaAsync(idxMacchina) ?? new(),
tagList: [Utils.redisStatoMacch]
);
@@ -1922,7 +1870,7 @@ namespace MP.SPEC.Data
return await GetOrFetchAsync(
operationName: "TemplateKitFiltAsync",
cacheKey: currKey,
- expiration: getRandTOut(redisLongTimeCache),
+ expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.TemplateKitFiltAsync(codParent, codChild) ?? new List(),
tagList: [Utils.redisKitTempl]
);
@@ -2087,154 +2035,6 @@ namespace MP.SPEC.Data
#endregion Public Methods
- #region Protected Methods
-
- protected async Task FlushCacheArticoli()
- {
- using var activity = ActivitySource.StartActivity("FlushCacheArticoli");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List() { Utils.redisArtList, Utils.redisArtByDossier });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushCacheArticoli | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- protected async Task FlushCacheConfig()
- {
- using var activity = ActivitySource.StartActivity("FlushCacheConfig");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List() { Utils.redisConfKey });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushCacheConfig | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- ///
- /// Reset macchine e gruppi
- ///
- protected async Task FlushCacheMacGrp()
- {
- using var activity = ActivitySource.StartActivity("FlushCacheMacGrp");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List { Utils.redisAnagGruppi, Utils.redisMacList });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushCacheMacGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- ///
- /// Reset cache operatori e gruppi
- ///
- protected async Task FlushCacheOprGrp()
- {
- using var activity = ActivitySource.StartActivity("FlushCacheOprGrp");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List { Utils.redisAnagGruppi, Utils.redisOprList });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushCacheOprGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- protected async Task FlushCachePOdl()
- {
- using var activity = ActivitySource.StartActivity("FlushCachePOdl");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List() { Utils.redisXdlData, Utils.redisPOdlByOdl, Utils.redisPOdlByPOdl, Utils.redisPOdlList });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushCachePOdl | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- ///
- /// Cancellazione FusionCache (totale)
- ///
- ///
- protected async Task FlushFusionCacheAsync()
- {
- await _cache.ClearAsync(allowFailSafe: false);
- _configData.Clear();
- _artCacheExpiry = DateTime.Now.AddHours(-1);
- return true;
- }
-
- ///
- /// Cancellazione FusionCache dato singolo tag
- ///
- ///
- protected async Task FlushFusionCacheAsync(string tag)
- {
- if (string.IsNullOrWhiteSpace(tag)) return false;
-
- await _cache.RemoveByTagAsync(tag);
- _configData.Clear();
- return true;
- }
-
- ///
- /// Cancellazione FusionCache dato elenco tags
- ///
- ///
- protected async Task FlushFusionCacheAsync(List listTags)
- {
- if (listTags == null || listTags.Count == 0) return false;
-
- // Generiamo i Task di rimozione ed eseguiamoli in parallelo su Redis/L1
- var tasks = listTags
- .Where(tag => !string.IsNullOrWhiteSpace(tag))
- .Select(tag => _cache.RemoveByTagAsync(tag).AsTask());
-
- await Task.WhenAll(tasks);
-
- _configData.Clear();
- return true;
- }
-
- protected async Task FlushKitCache()
- {
- using var activity = ActivitySource.StartActivity("FlushKitCache");
- string source = "FUSION";
- bool answ = await FlushFusionCacheAsync(new List() { Utils.redisPOdlList, Utils.redisKitInst, Utils.redisKitWip, Utils.redisKitScore, Utils.redisPOdlByCodArt });
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"FlushKitCache | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-
- ///
- /// Restituisce un timeout dal valore secondi richiesti + tempo random +/-3%
- ///
- ///
- ///
- protected TimeSpan getRandTOut(double durationSec)
- {
- double noise = (rand.NextDouble() * 0.06) - 0.03;
- double rValue = durationSec * (1 + noise);
- return TimeSpan.FromSeconds(rValue);
- }
-
- ///
- /// Merge statistiche DB Maintenance
- ///
- ///
- ///
- protected async Task RecDbMaintStatAsync(TimeSpan duration)
- {
- Dictionary actStats = await DbDedupStatsAsync();
- // aggiungo record!
- actStats.Add(DateTime.Now, duration.TotalSeconds);
- // salvo NUOVO record statistiche
- string currKey = $"{Utils.redisStatsDbMaint}";
- var rawData = JsonConvert.SerializeObject(actStats);
- return await redisDb.StringSetAsync(currKey, rawData);
- }
-
- #endregion Protected Methods
-
#region Private Fields
///
@@ -2269,8 +2069,6 @@ namespace MP.SPEC.Data
///
private HashSet _listCodArtUsed = new();
- private string canCacheParametri = "";
-
private string MpIoNS = "";
private Random rand = new Random();
@@ -2309,6 +2107,14 @@ namespace MP.SPEC.Data
#endregion Private Fields
+ #region Private Properties
+
+ private static MpSpecController dbController { get; set; } = null!;
+
+ private static MpMongoController mongoController { get; set; } = null!;
+
+ #endregion Private Properties
+
#region Private Methods
///
@@ -2327,14 +2133,176 @@ namespace MP.SPEC.Data
}
}
- private async Task FlushCacheFluxLog()
+ ///
+ /// Esegue flush memoria redis dato keyVal, async
+ ///
+ ///
+ ///
+ private async Task ExecFlushRedisPatternAsync(RedisValue pat2Flush)
{
- using var activity = ActivitySource.StartActivity("FlushCacheFluxLog");
+ bool answ = false;
+ using var activity = ActivitySource.StartActivity("ExecFlushRedisPatternAsync");
+ string source = "REDIS";
+ var masterEndpoint = redisConn.GetEndPoints()
+ .Where(ep => redisConn.GetServer(ep).IsConnected && !redisConn.GetServer(ep).IsReplica)
+ .FirstOrDefault();
+
+ // sepattern è "*" elimino intero DB...
+ if (masterEndpoint != null && (pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
+ {
+ redisConn.GetServer(masterEndpoint).FlushDatabase(database: redisDb.Database);
+ }
+ else
+ {
+ var server = redisConn.GetServer(masterEndpoint);
+ var keys = server.Keys(database: redisDb.Database, pattern: pat2Flush, pageSize: 1000);
+
+ var deleteTasks = new List();
+ foreach (var key in keys)
+ {
+ deleteTasks.Add(redisDb.KeyDeleteAsync(key));
+ if (deleteTasks.Count >= 1000)
+ {
+ await Task.WhenAll(deleteTasks);
+ deleteTasks.Clear();
+ }
+ }
+ if (deleteTasks.Count > 0)
+ {
+ await Task.WhenAll(deleteTasks);
+ }
+ }
+ answ = true;
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"ExecFlushRedisPatternAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ private async Task FlushFusionCacheArticoli()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheArticoli");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List() { Utils.redisArtList, Utils.redisArtByDossier });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCacheArticoli | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ ///
+ /// Cancellazione FusionCache (totale)
+ ///
+ ///
+ private async Task FlushFusionCacheAsync()
+ {
+ await _cache.ClearAsync(allowFailSafe: false);
+ _configData.Clear();
+ _artCacheExpiry = DateTime.Now.AddHours(-1);
+ return true;
+ }
+
+ ///
+ /// Cancellazione FusionCache dato singolo tag
+ ///
+ ///
+ private async Task FlushFusionCacheAsync(string tag)
+ {
+ if (string.IsNullOrWhiteSpace(tag)) return false;
+
+ await _cache.RemoveByTagAsync(tag);
+ _configData.Clear();
+ return true;
+ }
+
+ ///
+ /// Cancellazione FusionCache dato elenco tags
+ ///
+ ///
+ private async Task FlushFusionCacheAsync(List listTags)
+ {
+ if (listTags == null || listTags.Count == 0) return false;
+
+ // Generiamo i Task di rimozione ed eseguiamoli in parallelo su Redis/L1
+ var tasks = listTags
+ .Where(tag => !string.IsNullOrWhiteSpace(tag))
+ .Select(tag => _cache.RemoveByTagAsync(tag).AsTask());
+
+ await Task.WhenAll(tasks);
+
+ _configData.Clear();
+ return true;
+ }
+
+ private async Task FlushFusionCacheConfig()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheConfig");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List() { Utils.redisConfKey });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCacheConfig | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ private async Task FlushFusionCacheFluxLog()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheFluxLog");
string source = "FUSION";
bool answ = await FlushFusionCacheAsync(new List() { Utils.redisFluxLogFilt, Utils.redisParetoFLKey });
activity?.SetTag("data.source", source);
activity?.Stop();
- LogTrace($"FlushCacheFluxLog | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"FlushFusionCacheFluxLog | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ private async Task FlushFusionCacheKit()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheKit");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List() { Utils.redisPOdlList, Utils.redisKitInst, Utils.redisKitWip, Utils.redisKitScore, Utils.redisPOdlByCodArt });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCacheKit | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ ///
+ /// Reset macchine e gruppi
+ ///
+ private async Task FlushFusionCacheMacGrp()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheMacGrp");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List { Utils.redisAnagGruppi, Utils.redisMacList });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCacheMacGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ ///
+ /// Reset cache operatori e gruppi
+ ///
+ private async Task FlushFusionCacheOprGrp()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCacheOprGrp");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List { Utils.redisAnagGruppi, Utils.redisOprList });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCacheOprGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ return answ;
+ }
+
+ private async Task FlushFusionCachePOdl()
+ {
+ using var activity = ActivitySource.StartActivity("FlushFusionCachePOdl");
+ string source = "FUSION";
+ bool answ = await FlushFusionCacheAsync(new List() { Utils.redisXdlData, Utils.redisPOdlByOdl, Utils.redisPOdlByPOdl, Utils.redisPOdlList });
+ activity?.SetTag("data.source", source);
+ activity?.Stop();
+ LogTrace($"FlushFusionCachePOdl | {source} | {activity?.Duration.TotalMilliseconds}ms");
return answ;
}
@@ -2405,6 +2373,18 @@ namespace MP.SPEC.Data
return final!;
}
+ ///
+ /// Restituisce un timeout dal valore secondi richiesti + tempo random +/-3%
+ ///
+ ///
+ ///
+ private TimeSpan GetRandTOut(double durationSec)
+ {
+ double noise = (rand.NextDouble() * 0.06) - 0.03;
+ double rValue = durationSec * (1 + noise);
+ return TimeSpan.FromSeconds(rValue);
+ }
+
///
/// Helper trace messaggio log (SE abilitato)
///
@@ -2462,7 +2442,23 @@ namespace MP.SPEC.Data
return await redisDb.StringSetAsync(currKey, rawData);
}
- private string redHashMpIO(string keyName)
+ ///
+ /// Merge statistiche DB Maintenance
+ ///
+ ///
+ ///
+ private async Task RecDbMaintStatAsync(TimeSpan duration)
+ {
+ Dictionary actStats = await DbDedupStatsAsync();
+ // aggiungo record!
+ actStats.Add(DateTime.Now, duration.TotalSeconds);
+ // salvo NUOVO record statistiche
+ string currKey = $"{Utils.redisStatsDbMaint}";
+ var rawData = JsonConvert.SerializeObject(actStats);
+ return await redisDb.StringSetAsync(currKey, rawData);
+ }
+
+ private string RedHashMpIO(string keyName)
{
string result = keyName;
try
@@ -2471,7 +2467,7 @@ namespace MP.SPEC.Data
}
catch (Exception exc)
{
- Log.Error($"Errore in redHashMpIO{Environment.NewLine}{exc}");
+ Log.Error($"Errore in RedHashMpIO{Environment.NewLine}{exc}");
}
return result;
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj
index fb313057..55f50d46 100644
--- a/MP.Stats/MP.Stats.csproj
+++ b/MP.Stats/MP.Stats.csproj
@@ -4,7 +4,7 @@
net8.0
MP.Stats
826e877c-ba70-4253-84cb-d0b1cafd4440
- 8.16.2605.2912
+ 8.16.2606.0107
true
en
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html
index 1b148368..995d1a5a 100644
--- a/MP.Stats/Resources/ChangeLog.html
+++ b/MP.Stats/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo statistiche MAPO
-
Versione: 8.16.2605.2912
+ Versione: 8.16.2606.0107
Note di rilascio:
diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt
index a0cc7bd5..189d4f36 100644
--- a/MP.Stats/Resources/VersNum.txt
+++ b/MP.Stats/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2912
+8.16.2606.0107
diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml
index 49b25e7c..939d6d59 100644
--- a/MP.Stats/Resources/manifest.xml
+++ b/MP.Stats/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2912
+ 8.16.2606.0107
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html
false
diff --git a/Refactor_Plan.md b/Refactor_Plan.md
index 12a5cf0a..034e4602 100644
--- a/Refactor_Plan.md
+++ b/Refactor_Plan.md
@@ -9,7 +9,7 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
## Strategia di Migrazione
- **Metodo Standard**: `GetOrFetchAsync(string operationName, string cacheKey, Func> fetchFunc, TimeSpan expiration, params string[] tagList)`.
-- **Invalidazione**: Utilizzare i tag tramite `FlushCacheByTagAsync`.
+- **Invalidazione**: Utilizzare i tag tramite `FlushFusionCacheByTagAsync`.
## Stato Avanzamento
@@ -19,7 +19,7 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
### Fase 2: Refactoring Metodi di Lettura (Cache-aside) (In corso)
-#### ✅ Metodi Migrati (Usano già `GetOrFetchAsync`, `FusionCache.GetOrSet` o `FlushCacheByTagAsync`)
+#### ✅ Metodi Migrati (Usano già `GetOrFetchAsync`, `FusionCache.GetOrSet` o `FlushFusionCacheByTagAsync`)
- `AnagEventiGeneralAsync`
- `AnagStatiCommAsync`
- `AnagTipoArtLvAsync`
@@ -65,15 +65,17 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- `Grp2MaccInsertAsync` (Migrato con tag invalidazione)
- `Grp2OperDeleteAsync` (Migrato con tag invalidazione)
- `Grp2OperInsertAsync` (Migrato con tag invalidazione)
+- `ArticoliDeleteRecord` (Migrato con `FlushCacheArticoli`)
+- `ArticoliUpdateRecord` (Migrato con `FlushCacheArticoli`)
+- `DossiersDeleteRecordAsync` (Migrato con tag invalidazione)
+- `DossiersTakeParamsSnapshotLast` (Migrato con tag invalidazione)
+- `DossiersInsert` (Migrato con tag invalidazione)
+- `DossiersUpdateValoreAsync` (Migrato con tag invalidazione)
+- `ElencoRepartiDTO` (Migrato)
-#### 🛠️ Metodi da Migrare (Usano ancora Redis/DB manuale)
+#### 🛠️ Metodi da Migrare (Usano ancora Redis/DB manuale o pattern non standard per Fusion)
- [ ] Migrazione di `ActionGetReq` (linea 110: usa `redisDb.StringGetAsync`).
- [ ] Migrazione di `ActionSetReq` (linea 136: usa `BroadastMsgPipe.saveAndSendMessage`).
-- [ ] Migrazione di `ArticoliDeleteRecord`/`UpdateRecord` (linea 296/372: usa `resetCacheArticoli`).
-- [ ] Migrazione di `DbDedupStats` (linea 516: usa `redisDb.StringGet`).
-- [ ] Migrazione di `DossiersDeleteRecord` (linea 551: usa `ExecFlushRedisPatternAsync`).
-- [ ] Migrazione di `DossiersTakeParamsSnapshotLast` (linea 610: usa `ExecFlushRedisPatternAsync`).
-- [ ] Migrazione di `ElencoRepartiDTO` (linea 697: usa `redisDb.StringGet` e `StringSet`).
- [ ] Migrazione di `PodlIstKitDelete` (linea 1760: usa `ExecFlushRedisPattern` sincrono).
- [ ] Migrazione di `POdlListByKitParent` (linea 1781: usa `redisDb.StringGet` e `StringSet`).
- [ ] Migrazione di `POdlGetByKey` (linea 1662: usa `redisDb.StringGet` e `StringSet`).
@@ -82,7 +84,7 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- [ ] Migrazione di `ProcFLStats` (linea 1853: usa `redisDb.StringGet`).
- [ ] Migrazione di `RecDbMaintStat` (linea 2451: usa `redisDb.StringSet`).
-*(Nota: Il vecchio metodo `VocabolarioGetAll` e la gestione manuale del dizionario sono stati rimossi in favore di `Traduci` con FusionCache).*
+*(Nota: I metodi `DbDedupStatsAsync` e `RecDbMaintStatAsync` sono gestiti direttamente su Redis in modo persistente e non sono target della migrazione a FusionCache).*
### Fase 4: Verifica
- [ ] Verificare la compilazione della soluzione tramite script PowerShell.
@@ -98,3 +100,5 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
+
+