RImozione vecchio pacchetto cache redis completata anche da LicMan
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MP.AppAuth.Controllers;
|
||||
using MP.AppAuth.Models;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using MP.AppAuth.Models;
|
||||
using StackExchange.Redis;
|
||||
using MP.AppAuth.Controllers;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
@@ -24,15 +20,15 @@ namespace MP.Land.Data
|
||||
// diritti (cablòato)
|
||||
public const string RoleSuperAdmin = "MoonPro_SuperAdmin";
|
||||
|
||||
public static AppAuth.Controllers.AppAuthController dbController;
|
||||
public static AppAuth.Controllers.MPController MpDbController;
|
||||
public static AppAuth.Controllers.MPUserController userController;
|
||||
public static AppAuthController dbController;
|
||||
public static MPController MpDbController;
|
||||
public static MPUserController userController;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthService(IConfiguration configuration, ILogger<AppAuthService> logger, IConnectionMultiplexer redisConnMult, IMemoryCache memoryCache, IDistributedCache distributedCache)
|
||||
public AppAuthService(IConfiguration configuration, ILogger<AppAuthService> logger, IConnectionMultiplexer redisConnMult)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
@@ -51,11 +47,6 @@ namespace MP.Land.Data
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
||||
};
|
||||
|
||||
#if false
|
||||
// conf cache
|
||||
this.memoryCache = memoryCache;
|
||||
this.distributedCache = distributedCache;
|
||||
#endif
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("MP.Land");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
@@ -241,16 +232,6 @@ namespace MP.Land.Data
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<UserDirittiModel>>(rawData);
|
||||
#if false
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<UserDirittiModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
#endif
|
||||
dbResult = tempResult ?? new List<UserDirittiModel>();
|
||||
}
|
||||
else
|
||||
@@ -330,10 +311,6 @@ namespace MP.Land.Data
|
||||
{
|
||||
RedisValue pattern = new RedisValue($"{redisBaseAddr}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
#if false
|
||||
string cacheKey = ":MP:VOCAB";
|
||||
await distributedCache.RemoveAsync(cacheKey);
|
||||
#endif
|
||||
// reset in RAM
|
||||
Vocabolario = new Dictionary<string, string>();
|
||||
await CheckVoc();
|
||||
@@ -485,11 +462,6 @@ namespace MP.Land.Data
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static string Modulo = "";
|
||||
#if false
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
private readonly IMemoryCache memoryCache;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache lunga IN SECONDI
|
||||
@@ -501,19 +473,6 @@ namespace MP.Land.Data
|
||||
/// </summary>
|
||||
private int cacheTtlShort = 60 * 1;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// </summary>
|
||||
private int chAbsExp = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa NON
|
||||
/// estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
private int chSliExp = 5;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
@@ -532,24 +491,6 @@ namespace MP.Land.Data
|
||||
|
||||
#region Private Properties
|
||||
|
||||
#if false
|
||||
private DistributedCacheEntryOptions cacheOpt
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
private DistributedCacheEntryOptions cacheOptLong
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private string CodApp { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user