Add metodi x reset cache invSession

This commit is contained in:
Samuele Locatelli
2022-12-19 10:13:58 +01:00
parent f016d8dbd7
commit 99afef8060
+25 -2
View File
@@ -390,6 +390,10 @@ namespace MP.INVE.Data
return SteamCrypto.EncryptString(rawData, passPhrase);
}
/// <summary>
/// Svuota tutta la sessione dalla root di gestione
/// </summary>
/// <returns></returns>
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
@@ -397,8 +401,27 @@ namespace MP.INVE.Data
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
/// Svuota solo il pattern richiesto
/// </summary>
/// <param name="basePattern"></param>
/// <returns></returns>
public async Task<bool> FlushRedisCache(string basePattern)
{
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{basePattern}*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
/// Svuota cahce sessioni inventario
/// <returns></returns>
public async Task<bool> FlushSessInvCache()
{
bool answ = await FlushRedisCache(redisSessionCurrList) && await FlushRedisCache(redisSessionHistList);
return answ;
}
public async Task<bool> InsertNewMag(AnagMagModel newMag)
{
@@ -469,7 +492,7 @@ namespace MP.INVE.Data
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<InventorySessionModel> result = new List<InventorySessionModel>();
List<InventorySessionModel>? result = new List<InventorySessionModel>();
string source = "DB";
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisSessionCurrList);