Fix reset cache anche di InsEnabled da reload
This commit is contained in:
@@ -152,7 +152,6 @@ namespace MP.Data.Services.IOC
|
||||
// 3. Conversione efficiente da RedisValue a string (evita l'interpolazione $"{val}")
|
||||
string? sRedisVal = val;
|
||||
return IsStringTrue(sRedisVal);
|
||||
|
||||
#if false
|
||||
var rKey = MP.Data.Utils.RedKeyDatiMacc(idxMacchina, MpIoNS);
|
||||
var val = await _redisDb.HashGetAsync(rKey, "insEnabled");
|
||||
@@ -170,7 +169,8 @@ namespace MP.Data.Services.IOC
|
||||
return !string.IsNullOrEmpty(sVal) && (sVal == "1" || sVal.ToLower() == "true");
|
||||
#endif
|
||||
},
|
||||
expiration: GetRandTOut(30),
|
||||
expiration: GetRandTOut(60),
|
||||
//expiration: GetRandTOut(30),
|
||||
tagList: ["IOC_IobInsEnab", cKey, idxMacchina]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,13 @@ namespace MP.Data.Services.Utils
|
||||
/// <returns></returns>
|
||||
Task ResetCache();
|
||||
|
||||
/// <summary>
|
||||
/// Forza il reset della cache REDIS x il pattern richiesto
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
Task ResetCache(string pattern);
|
||||
|
||||
/// <summary>
|
||||
/// Inserisce o aggiorna in batch le statistiche di dettaglio nel database.
|
||||
/// Opzionalmente elimina i record precedenti nel periodo specificato.
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace MP.Data.Services.Utils
|
||||
IConnectionMultiplexer redis,
|
||||
IFusionCache cache,
|
||||
IStatsDetailRepository repo
|
||||
) : base(config,cache, redis)
|
||||
) : base(config, cache, redis)
|
||||
{
|
||||
_className = "StatsDetail";
|
||||
_repo = repo;
|
||||
@@ -134,6 +134,14 @@ namespace MP.Data.Services.Utils
|
||||
await ClearCacheAsync($"{_redisBaseKey}:*");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task ResetCache(string pattern)
|
||||
{
|
||||
// tolgo eventuali ":" finali
|
||||
pattern = pattern.EndsWith(":") ? pattern.Substring(0, pattern.Length - 1) : pattern;
|
||||
await ClearCacheAsync($"{pattern}:*");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> UpsertManyAsync(List<StatsDetailModel> listRecords, bool removeOld)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user