Fix semaforo x cache in IOC x redis

This commit is contained in:
Samuele Locatelli
2026-05-11 12:30:16 +02:00
parent 77f79ba891
commit 926f8ae710
5 changed files with 9 additions and 23 deletions
+5 -19
View File
@@ -465,22 +465,10 @@ namespace MP.Data.Services.IOC
return cachedValue!;
}
await _semaphore.WaitAsync();
try
{
if (_cache.TryGetValue(cacheKey, out cachedValue))
{
return cachedValue!;
}
T newValue = await fetchFunc();
_cache.Set(cacheKey, newValue, expiration);
return newValue;
}
finally
{
_semaphore.Release();
}
// se non trovato procedo as usual...
T newValue = await fetchFunc();
_cache.Set(cacheKey, newValue, expiration);
return newValue;
}
/// <summary>
@@ -834,9 +822,7 @@ namespace MP.Data.Services.IOC
//double numSecCache = ((result["insEnabled"].ToLower() == "true") ? redisShortTimeCache : redisLongTimeCache);
numSecCache = dbResult.InsEnabled ? redisShortTimeCache : redisLongTimeCache;
}
else
{
}
// dati master/slave
string isMaster = (await ListMasterAsync()).Contains(idxMacc) ? "1" : "0";
string isSlave = (await ListSlaveAsync()).Contains(idxMacc) ? "1" : "0";
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>8.16.2605.811</Version>
<Version>8.16.2605.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 8.16.2605.811</h4>
<h4>Versione: 8.16.2605.1112</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2605.811
8.16.2605.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2605.811</version>
<version>8.16.2605.1112</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>