diff --git a/Data/Data.csproj b/Data/Data.csproj
index dc6d683a0..4cfdfc591 100644
--- a/Data/Data.csproj
+++ b/Data/Data.csproj
@@ -8,7 +8,7 @@
RaidMax.IW4MAdmin.Data
RaidMax.IW4MAdmin.Data
- 1.0.8
+ 1.0.9
diff --git a/Data/Helpers/DataValueCache.cs b/Data/Helpers/DataValueCache.cs
index bbe48e334..d2b7217a2 100644
--- a/Data/Helpers/DataValueCache.cs
+++ b/Data/Helpers/DataValueCache.cs
@@ -15,20 +15,21 @@ namespace Data.Helpers
private readonly ILogger _logger;
private readonly IDatabaseContextFactory _contextFactory;
- private readonly ConcurrentDictionary _cacheStates =
- new ConcurrentDictionary();
+ private readonly ConcurrentDictionary> _cacheStates =
+ new ConcurrentDictionary>();
private bool _autoRefresh;
private const int DefaultExpireMinutes = 15;
private Timer _timer;
- private class CacheState
+ private class CacheState
{
public string Key { get; set; }
public DateTime LastRetrieval { get; set; }
public TimeSpan ExpirationTime { get; set; }
- public Func, CancellationToken, Task> Getter { get; set; }
- public TReturnType Value { get; set; }
+ public Func, CancellationToken, Task> Getter { get; set; }
+ public TCacheType Value { get; set; }
+ public bool IsSet { get; set; }
public bool IsExpired => ExpirationTime != TimeSpan.MaxValue &&
(DateTime.Now - LastRetrieval.Add(ExpirationTime)).TotalSeconds > 0;
@@ -56,7 +57,7 @@ namespace Data.Helpers
return;
}
- var state = new CacheState
+ var state = new CacheState
{
Key = key,
Getter = getter,
@@ -88,7 +89,7 @@ namespace Data.Helpers
// when auto refresh is off we want to check the expiration and value
// when auto refresh is on, we want to only check the value, because it'll be refreshed automatically
- if ((state.IsExpired || state.Value == null) && !_autoRefresh || _autoRefresh && state.Value == null)
+ if ((state.IsExpired || !state.IsSet) && !_autoRefresh || _autoRefresh && !state.IsSet)
{
await RunCacheUpdate(state, cancellationToken);
}
@@ -96,7 +97,7 @@ namespace Data.Helpers
return state.Value;
}
- private async Task RunCacheUpdate(CacheState state, CancellationToken token)
+ private async Task RunCacheUpdate(CacheState state, CancellationToken token)
{
try
{
@@ -105,6 +106,7 @@ namespace Data.Helpers
var set = context.Set();
var value = await state.Getter(set, token);
state.Value = value;
+ state.IsSet = true;
state.LastRetrieval = DateTime.Now;
}
catch (Exception ex)
diff --git a/Plugins/AutomessageFeed/AutomessageFeed.csproj b/Plugins/AutomessageFeed/AutomessageFeed.csproj
index 29cafb8f1..29ac62efe 100644
--- a/Plugins/AutomessageFeed/AutomessageFeed.csproj
+++ b/Plugins/AutomessageFeed/AutomessageFeed.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj b/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj
index 4227042cb..897b6a8fe 100644
--- a/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj
+++ b/Plugins/IW4ScriptCommands/IW4ScriptCommands.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Plugins/LiveRadar/LiveRadar.csproj b/Plugins/LiveRadar/LiveRadar.csproj
index 628ee6aa6..d95c469f2 100644
--- a/Plugins/LiveRadar/LiveRadar.csproj
+++ b/Plugins/LiveRadar/LiveRadar.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/Plugins/Login/Login.csproj b/Plugins/Login/Login.csproj
index 13126634f..6aba5ceec 100644
--- a/Plugins/Login/Login.csproj
+++ b/Plugins/Login/Login.csproj
@@ -19,7 +19,7 @@
-
+
diff --git a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj
index 35fda70cc..fd348b7a9 100644
--- a/Plugins/ProfanityDeterment/ProfanityDeterment.csproj
+++ b/Plugins/ProfanityDeterment/ProfanityDeterment.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/Plugins/Stats/Stats.csproj b/Plugins/Stats/Stats.csproj
index 2cc2772ab..3f5eac16a 100644
--- a/Plugins/Stats/Stats.csproj
+++ b/Plugins/Stats/Stats.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/Plugins/Welcome/Welcome.csproj b/Plugins/Welcome/Welcome.csproj
index 9370e7924..b05ce10c9 100644
--- a/Plugins/Welcome/Welcome.csproj
+++ b/Plugins/Welcome/Welcome.csproj
@@ -20,7 +20,7 @@
-
+
diff --git a/SharedLibraryCore/SharedLibraryCore.csproj b/SharedLibraryCore/SharedLibraryCore.csproj
index ddff8537f..ccd47eb07 100644
--- a/SharedLibraryCore/SharedLibraryCore.csproj
+++ b/SharedLibraryCore/SharedLibraryCore.csproj
@@ -4,7 +4,7 @@
Library
netcoreapp3.1
RaidMax.IW4MAdmin.SharedLibraryCore
- 2021.11.15.1
+ 2021.11.21.1
RaidMax
Forever None
Debug;Release;Prerelease
@@ -19,7 +19,7 @@
true
MIT
Shared Library for IW4MAdmin
- 2021.11.15.1
+ 2021.11.21.1
@@ -44,11 +44,11 @@
-
+
-
+