Cleanup metodi e correzioni varie
This commit is contained in:
@@ -391,6 +391,7 @@ namespace MP.Data.Controllers
|
||||
.CountAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conteggio articoli data condizione ricerca
|
||||
/// </summary>
|
||||
@@ -429,6 +430,7 @@ namespace MP.Data.Controllers
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed) Async
|
||||
/// </summary>
|
||||
@@ -1827,7 +1829,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -1880,7 +1882,6 @@ namespace MP.Data.Controllers
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxOdl);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
|
||||
|
||||
// se richiesto confermo produzione
|
||||
if (confPezzi)
|
||||
{
|
||||
@@ -1971,7 +1972,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -2315,7 +2316,6 @@ namespace MP.Data.Controllers
|
||||
.AddAsync(editRec);
|
||||
}
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2477,6 +2477,20 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo) async
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VocabolarioModel>> VocabolarioGetAllAsync()
|
||||
{
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToListAsync() ?? new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario di una lingua
|
||||
/// </summary>
|
||||
@@ -2497,17 +2511,31 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo) async
|
||||
/// Upsert record Vocabolario
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VocabolarioModel>> VocabolarioGetAllAsync()
|
||||
public async Task<bool> VocabolarioUpsertAsync(VocabolarioModel upsRec)
|
||||
{
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToListAsync() ?? new();
|
||||
var actRec = await dbCtx
|
||||
.DbSetVocabolario
|
||||
.Where(x => x.Lingua == upsRec.Lingua && x.Lemma == upsRec.Lemma)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetVocabolario
|
||||
.Add(upsRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
actRec.Traduzione = upsRec.Traduzione;
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected async Task FlushCache()
|
||||
{
|
||||
await MDService.FlushRedisCache();
|
||||
await MDService.FlushCacheAsync();
|
||||
await MDService.ForceFlushRedisCache();
|
||||
await MDService.ForceFlushFusionCacheAsync();
|
||||
await ForceReload();
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
|
||||
@@ -67,9 +67,8 @@ namespace MP.SPEC.Components
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
await MDService.ForceFlushRedisCache();
|
||||
await MDService.ForceFlushFusionCacheAsync();
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
@@ -361,18 +361,20 @@ namespace MP.SPEC.Components
|
||||
string odlPad = newOdl.IdxOdl.ToString(padCodXdl);
|
||||
await callTask2Exe(selRec.IdxMacchina, "setComm", $"ODL{odlPad}");
|
||||
await callTask2Exe(selRec.IdxMacchina, "setPzComm", $"{newOdl.NumPezzi}");
|
||||
await Task.Delay(1);
|
||||
// chiamo task x IOB
|
||||
await callForceUpdate(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
await callForceUpdate(selRec.IdxMacchina);
|
||||
//await Task.Delay(1);
|
||||
//await callForceUpdate(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
await callSyncDb(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
|
||||
// svuoto memorie pagina...
|
||||
await MDService.FlushRedisCache();
|
||||
await MDService.ForceFlushRedisCache();
|
||||
// svuoto cache MpIoNsCache
|
||||
await MDService.FlushMpIoOdlCache();
|
||||
await MDService.FlushRedisCacheMpIoOdl();
|
||||
// svuoto altra cache
|
||||
await MDService.ForceFlushFusionCacheAsync();
|
||||
|
||||
// ricarico pagina!
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
|
||||
+106
-162
@@ -193,7 +193,7 @@ namespace MP.SPEC.Data
|
||||
string source = "DB";
|
||||
result = dbController.AnagGruppiDelete(updRec);
|
||||
// elimino cache redis...
|
||||
await FlushCacheAsync(Utils.redisAnagGruppi);
|
||||
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"AnagGruppiDeleteAsync | CodGruppo {updRec.CodGruppo} | {source}{activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -212,7 +212,7 @@ namespace MP.SPEC.Data
|
||||
string source = "DB";
|
||||
result = dbController.AnagGruppiUpsert(UpdRec);
|
||||
// elimino cache redis...
|
||||
await FlushCacheAsync(Utils.redisAnagGruppi);
|
||||
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"AnagGruppiUpsertAsync | CodGruppo {UpdRec.CodGruppo} | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -556,7 +556,7 @@ namespace MP.SPEC.Data
|
||||
bool result = false;
|
||||
result = await dbController.DossiersDeleteRecordAsync(selRecord);
|
||||
// elimino cache...
|
||||
await FlushCacheAsync(Utils.redisDossByMac);
|
||||
await FlushFusionCacheAsync(Utils.redisDossByMac);
|
||||
activity?.SetTag("data.source", "DB");
|
||||
activity?.Stop();
|
||||
LogTrace($"DossiersDeleteRecordAsync | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -595,7 +595,7 @@ namespace MP.SPEC.Data
|
||||
string source = "DB";
|
||||
// aggiorno record sul DB
|
||||
bool answ = await dbController.DossiersInsertAsync(currDoss);
|
||||
answ = await FlushCacheAsync(Utils.redisDossByMac);
|
||||
answ = await FlushFusionCacheAsync(Utils.redisDossByMac);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"DossiersInsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -618,7 +618,7 @@ namespace MP.SPEC.Data
|
||||
// chiamo stored x salvare parametri
|
||||
await dbController.DossiersTakeParamsSnapshotLastAsync(IdxMacchina, dtMin, dtMax);
|
||||
// elimino cache...
|
||||
answ = await FlushCacheAsync(Utils.redisDossByMac);
|
||||
answ = await FlushFusionCacheAsync(Utils.redisDossByMac);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"DossiersTakeParamsSnapshotLastAsync | Svuotata cache dossier | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -636,7 +636,7 @@ namespace MP.SPEC.Data
|
||||
string source = "DB";
|
||||
// aggiorno record sul DB
|
||||
bool answ = await dbController.DossiersUpdateValoreAsync(currDoss);
|
||||
answ = await FlushCacheAsync(Utils.redisDossByMac);
|
||||
answ = await FlushFusionCacheAsync(Utils.redisDossByMac);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"DossiersUpdateValoreAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -805,57 +805,13 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache (totale)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushCacheAsync()
|
||||
{
|
||||
await _cache.ClearAsync(allowFailSafe: false);
|
||||
_configData.Clear();
|
||||
_artCacheExpiry = DateTime.Now.AddHours(-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato singolo tag
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushCacheAsync(string tag)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tag)) return false;
|
||||
|
||||
await _cache.RemoveByTagAsync(tag);
|
||||
_configData.Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato elenco tags
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushCacheAsync(List<string> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flush cache relativa a MP-IO x dati ODL
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushMpIoOdlCache()
|
||||
public async Task<bool> FlushRedisCacheMpIoOdl()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushMpIoOdlCache");
|
||||
using var activity = ActivitySource.StartActivity("FlushRedisCacheMpIoOdl");
|
||||
string source = "REDIS";
|
||||
// svuoto dalla cache REDIS del server IO...
|
||||
bool ok01 = await ResetIoCache("CurrODL");
|
||||
@@ -864,24 +820,10 @@ namespace MP.SPEC.Data
|
||||
bool ok04 = await ResetIoCache("DtMac");
|
||||
activity?.SetTag("data.source", "REDIS");
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushMpIoOdlCache | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"FlushRedisCacheMpIoOdl | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return ok01 && ok02 && ok03 && ok04;
|
||||
}
|
||||
|
||||
public async Task<bool> FlushRedisCache()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushRedisCache");
|
||||
string source = "FUSION";
|
||||
// valutare se tenere
|
||||
RedisValue pattern = Utils.RedValue("*");
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
// pulisco fusionlog cache...
|
||||
bool answ = await FlushCacheAsync();
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCache | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Funzione di Data Reduction x FluxLog
|
||||
/// </summary>
|
||||
@@ -996,6 +938,29 @@ namespace MP.SPEC.Data
|
||||
await RecDbMaintStatAsync(activity?.Duration ?? TimeSpan.FromSeconds(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache (totale) - wrapper public
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> ForceFlushFusionCacheAsync()
|
||||
{
|
||||
return FlushFusionCacheAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> ForceFlushRedisCache()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ForceFlushRedisCache");
|
||||
string source = "FUSION";
|
||||
// valutare se tenere
|
||||
RedisValue pattern = Utils.RedValue("*");
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
// pulisco fusionlog cache...
|
||||
bool answ = await FlushFusionCacheAsync();
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCache | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione di un record macchina dal gruppo
|
||||
/// </summary>
|
||||
@@ -1419,7 +1384,7 @@ namespace MP.SPEC.Data
|
||||
// chiamo metodo conferma!
|
||||
fatto = await dbController.ODLCloseAsync(idxOdl, idxMacchina, matrOpr, confPezzi, confRett, modoConfProd);
|
||||
|
||||
await FlushCacheAsync(Utils.redisOdlByKey);
|
||||
await FlushFusionCacheAsync(Utils.redisOdlByKey);
|
||||
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
@@ -1450,6 +1415,23 @@ namespace MP.SPEC.Data
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<StatODLModel>> OdlStatsAsync(int IdxOdl)
|
||||
{
|
||||
string currKey = $"{Utils.redisOdlStats}:{IdxOdl}";
|
||||
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "OdlStatsAsync",
|
||||
cacheKey: currKey,
|
||||
expiration: getRandTOut(redisShortTimeCache),
|
||||
fetchFunc: async () => await dbController.OdlGetStatAsync(IdxOdl) ?? new(),
|
||||
tagList: [Utils.redisOdlStats]
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori filtrati x gruppo
|
||||
/// </summary>
|
||||
@@ -1606,46 +1588,6 @@ namespace MP.SPEC.Data
|
||||
fetchFunc: async () => await dbController.PODL_getByKeyAsync(idxPODL) ?? new(),
|
||||
tagList: [Utils.redisPOdlByPOdl]
|
||||
);
|
||||
#if false
|
||||
PODLModel result = new PODLModel();
|
||||
if (idxPODL != 0)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("POdlGetByKey");
|
||||
string source = "DB";
|
||||
string currKey = $"{Utils.redisPOdlByPOdl}:{idxPODL}";
|
||||
// cerco in redis dato valore sel idxMaccSel...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
var rawResult = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
|
||||
if (rawResult != null)
|
||||
{
|
||||
result = rawResult;
|
||||
source = "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();
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", 1);
|
||||
activity?.Stop();
|
||||
Log.Trace($"POdlGetByKey | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Debug("Errore IdxPODL = 0");
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1931,33 +1873,6 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<StatODLModel>> OdlStatsAsync(int IdxOdl)
|
||||
{
|
||||
string currKey = $"{Utils.redisOdlStats}:{IdxOdl}";
|
||||
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "OdlStatsAsync",
|
||||
cacheKey: currKey,
|
||||
expiration: getRandTOut(redisShortTimeCache),
|
||||
fetchFunc: async () => await dbController.OdlGetStatAsync(IdxOdl) ?? new(),
|
||||
tagList: [Utils.redisOdlStats]
|
||||
);
|
||||
|
||||
#if false
|
||||
using var activity = ActivitySource.StartActivity("OdlStatsAsync");
|
||||
string source = "DB";
|
||||
var result = await dbController.OdlGetStatAsync(IdxOdl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"OdlStatsAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stato macchina
|
||||
/// </summary>
|
||||
@@ -1987,7 +1902,7 @@ namespace MP.SPEC.Data
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = await dbController.TemplateKitDeleteAsync(currRecord);
|
||||
await FlushCacheAsync(Utils.redisKitTempl);
|
||||
await FlushFusionCacheAsync(Utils.redisKitTempl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"TemplateKitDeleteAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2025,7 +1940,7 @@ namespace MP.SPEC.Data
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitUpsert(currRecord, codAzienda);
|
||||
await FlushCacheAsync(Utils.redisKitTempl);
|
||||
await FlushFusionCacheAsync(Utils.redisKitTempl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"TemplateKitUpsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2108,7 +2023,7 @@ namespace MP.SPEC.Data
|
||||
// salvo
|
||||
fatto = await dbController.WipKitDeleteAsync(currRecord);
|
||||
// svuoto cache
|
||||
await FlushCacheAsync(Utils.redisKitWip);
|
||||
await FlushFusionCacheAsync(Utils.redisKitWip);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"WipKitDeleteAsync Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2127,7 +2042,7 @@ namespace MP.SPEC.Data
|
||||
// salvo
|
||||
fatto = await dbController.WipKitDeleteOlderAsync(DateLimit);
|
||||
// svuoto cache KitWip
|
||||
await FlushCacheAsync(Utils.redisKitWip);
|
||||
await FlushFusionCacheAsync(Utils.redisKitWip);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"WipKitDeleteOlderAsync Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2163,7 +2078,7 @@ namespace MP.SPEC.Data
|
||||
// salvo
|
||||
fatto = await dbController.WipKitUpsertAsync(currRecord);
|
||||
// svuoto cache KitWip
|
||||
await FlushCacheAsync(Utils.redisKitWip);
|
||||
await FlushFusionCacheAsync(Utils.redisKitWip);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"WipKitUpsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2178,7 +2093,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushCacheArticoli");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string>() { Utils.redisArtList, Utils.redisArtByDossier });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string>() { Utils.redisArtList, Utils.redisArtByDossier });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCacheArticoli | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2189,7 +2104,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushCacheConfig");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string>() { Utils.redisConfKey });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string>() { Utils.redisConfKey });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCacheConfig | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2203,7 +2118,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushCacheMacGrp");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisMacList });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisMacList });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCacheMacGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2217,7 +2132,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushCacheOprGrp");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisOprList });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string> { Utils.redisAnagGruppi, Utils.redisOprList });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCacheOprGrp | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2226,35 +2141,64 @@ namespace MP.SPEC.Data
|
||||
|
||||
protected async Task<bool> FlushCachePOdl()
|
||||
{
|
||||
#if false
|
||||
using var activity = ActivitySource.StartActivity("POdlFlushCache");
|
||||
bool answ = false;
|
||||
RedisValue pattern = new RedisValue($"{Utils.redisXdlData}:*");
|
||||
answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
pattern = new RedisValue($"{Utils.redisPOdlByOdl}:*");
|
||||
answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
pattern = new RedisValue($"{Utils.redisPOdlByPOdl}:*");
|
||||
answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
pattern = new RedisValue($"{Utils.redisPOdlList}:*");
|
||||
answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
activity?.SetTag("data.source", "REDIS");
|
||||
return answ;
|
||||
#endif
|
||||
|
||||
using var activity = ActivitySource.StartActivity("FlushCachePOdl");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string>() { Utils.redisXdlData, Utils.redisPOdlByOdl, Utils.redisPOdlByPOdl, Utils.redisPOdlList });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string>() { Utils.redisXdlData, Utils.redisPOdlByOdl, Utils.redisPOdlByPOdl, Utils.redisPOdlList });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCachePOdl | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache (totale)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> FlushFusionCacheAsync()
|
||||
{
|
||||
await _cache.ClearAsync(allowFailSafe: false);
|
||||
_configData.Clear();
|
||||
_artCacheExpiry = DateTime.Now.AddHours(-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato singolo tag
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> FlushFusionCacheAsync(string tag)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tag)) return false;
|
||||
|
||||
await _cache.RemoveByTagAsync(tag);
|
||||
_configData.Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancellazione FusionCache dato elenco tags
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> FlushFusionCacheAsync(List<string> 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<bool> FlushKitCache()
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushKitCache");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string>() { Utils.redisPOdlList, Utils.redisKitInst, Utils.redisKitWip, Utils.redisKitScore, Utils.redisPOdlByCodArt });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string>() { Utils.redisPOdlList, Utils.redisKitInst, Utils.redisKitWip, Utils.redisKitScore, Utils.redisPOdlByCodArt });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushKitCache | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -2387,7 +2331,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("FlushCacheFluxLog");
|
||||
string source = "FUSION";
|
||||
bool answ = await FlushCacheAsync(new List<string>() { Utils.redisFluxLogFilt, Utils.redisParetoFLKey });
|
||||
bool answ = await FlushFusionCacheAsync(new List<string>() { Utils.redisFluxLogFilt, Utils.redisParetoFLKey });
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"FlushCacheFluxLog | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>8.16.2605.3012</Version>
|
||||
<Version>8.16.2606.107</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -110,9 +110,9 @@ namespace MP.SPEC.Pages
|
||||
protected async Task forceReloadCache()
|
||||
{
|
||||
Log.Debug("----- forceReloadCache on PARAMS.cs -----");
|
||||
await MDService.ForceFlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
await MDService.ForceFlushFusionCacheAsync();
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true, true);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace MP.SPEC.Pages
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await MDService.ForceFlushRedisCache();
|
||||
await MDService.ForceFlushFusionCacheAsync();
|
||||
// rimando a home
|
||||
NavManager.NavigateTo("", true);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 8.16.2605.3012</h4>
|
||||
<h4>Versione: 8.16.2606.107</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.3012
|
||||
8.16.2606.107
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.3012</version>
|
||||
<version>8.16.2606.107</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user