From 99afef80600c6ee539abb8546fcad3f10738d990 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 10:13:58 +0100 Subject: [PATCH] Add metodi x reset cache invSession --- MP.INVE/Data/MiDataService.cs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 54ebdbc2..1392243c 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -390,6 +390,10 @@ namespace MP.INVE.Data return SteamCrypto.EncryptString(rawData, passPhrase); } + /// + /// Svuota tutta la sessione dalla root di gestione + /// + /// public async Task FlushRedisCache() { await Task.Delay(1); @@ -397,8 +401,27 @@ namespace MP.INVE.Data bool answ = await ExecFlushRedisPattern(pattern); return answ; } + /// + /// Svuota solo il pattern richiesto + /// + /// + /// + public async Task FlushRedisCache(string basePattern) + { + await Task.Delay(1); + RedisValue pattern = new RedisValue($"{basePattern}*"); + bool answ = await ExecFlushRedisPattern(pattern); + return answ; + } - + /// + /// Svuota cahce sessioni inventario + /// + public async Task FlushSessInvCache() + { + bool answ = await FlushRedisCache(redisSessionCurrList) && await FlushRedisCache(redisSessionHistList); + return answ; + } public async Task InsertNewMag(AnagMagModel newMag) { @@ -469,7 +492,7 @@ namespace MP.INVE.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - List result = new List(); + List? result = new List(); string source = "DB"; // cerco in redis... RedisValue rawData = redisDb.StringGet(redisSessionCurrList);