Update conf scadenze rapide/lunghe x cache
This commit is contained in:
@@ -17,6 +17,7 @@ namespace MP.Core
|
||||
public const string redisArtList = redisBaseAddr + "Cache:ArtList";
|
||||
public const string redisBaseAddr = "MP:";
|
||||
public const string redisConfFlux = redisBaseAddr + "Cache:ConfFlux";
|
||||
public const string redisConfAll = redisBaseAddr + "Cache:ConfigAll";
|
||||
public const string redisConfKey = redisBaseAddr + "Cache:Config";
|
||||
public const string redisDecNumArtKey = redisBaseAddr + "Cache:DecNumArt";
|
||||
public const string redisDossByMac = redisBaseAddr + "Cache:DossByMac";
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace MP.SPEC.Data
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis") ?? "localhost:6379");
|
||||
redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin") ?? "localhost:6379");
|
||||
redisDb = redisConn.GetDatabase();
|
||||
// leggo cache lungo periodo
|
||||
// leggo cache lungo/cordo periodo
|
||||
int.TryParse(_configuration.GetValue<string>("ServerConf:redisShortTimeCache"), out redisShortTimeCache);
|
||||
int.TryParse(_configuration.GetValue<string>("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
|
||||
|
||||
// setup MsgPipe
|
||||
@@ -410,7 +411,7 @@ namespace MP.SPEC.Data
|
||||
string source = "REDIS";
|
||||
List<ConfigModel>? result = new List<ConfigModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Utils.redisConfKey);
|
||||
RedisValue rawData = redisDb.StringGet($"{Utils.redisConfKey}_sync");
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
|
||||
@@ -421,7 +422,7 @@ namespace MP.SPEC.Data
|
||||
result = dbController.ConfigGetAll();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(Utils.redisConfKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
redisDb.StringSet($"{Utils.redisConfKey}_sync", rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -442,10 +443,10 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "ConfigGetAllAsync",
|
||||
cacheKey: Utils.redisConfKey,
|
||||
expiration: getRandTOut(redisLongTimeCache),
|
||||
cacheKey: Utils.redisConfAll,
|
||||
expiration: getRandTOut(redisLongTimeCache * 2),
|
||||
fetchFunc: async () => await dbController.ConfigGetAllAsync() ?? new List<ConfigModel>(),
|
||||
tagList: [Utils.redisConfKey]
|
||||
tagList: [Utils.redisConfAll]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": 2,
|
||||
"redisLongTimeCache": 15,
|
||||
"MpIoBaseUrl": "https://iis01.egalware.com/MP/IO/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": 2,
|
||||
"redisLongTimeCache": 15,
|
||||
"redisShortTimeCache": 10,
|
||||
"redisLongTimeCache": 600,
|
||||
"MpIoBaseUrl": "http://localhost/MP/IO/",
|
||||
"MpIoNS": "MoonPro:SQL2016DEV:MoonPro",
|
||||
"BasePathOdlReturn": "\\\\iis01\\W$\\Files\\ODL",
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": 2,
|
||||
"redisLongTimeCache": 15,
|
||||
"MpIoBaseUrl": "http://localhost/MP/IO/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": "2",
|
||||
"redisLongTimeCache": "15",
|
||||
"redisShortTimeCache": 5,
|
||||
"redisLongTimeCache": 120,
|
||||
"MpIoBaseUrl": "http://localhost:20967/",
|
||||
"MpIoNS": "MoonPro:SQL2016DEV:MoonPro",
|
||||
"BasePathOdlReturn": "\\\\iis01\\ODL\\ftpdata\\syncfolder",
|
||||
|
||||
Reference in New Issue
Block a user