use new cache signature

This commit is contained in:
RaidMax 2021-08-27 21:05:30 -05:00
parent 27e9ecfd9d
commit 162006da29
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ namespace IW4MAdmin.Application.Misc
private readonly IDataValueCache<EFClient, (int, int)> _serverStatsCache;
private readonly TimeSpan? _cacheTimeSpan =
Utilities.IsDevelopment ? TimeSpan.FromSeconds(1) : (TimeSpan?) null;
Utilities.IsDevelopment ? TimeSpan.FromSeconds(1) : (TimeSpan?) TimeSpan.FromMinutes(1);
public ServerDataViewer(ILogger<ServerDataViewer> logger, IDataValueCache<EFServerSnapshot, int> snapshotCache,
IDataValueCache<EFClient, (int, int)> serverStatsCache)

View File

@ -45,7 +45,7 @@ namespace Stats.Client
public async Task Initialize()
{
await LoadServers();
_distributionCache.SetCacheItem((async set =>
_distributionCache.SetCacheItem((async (set, token) =>
{
var validPlayTime = _configurationHandler.Configuration()?.TopPlayersMinPlayTime ?? 3600 * 3;
@ -70,7 +70,7 @@ namespace Stats.Client
return distributions;
}), DistributionCacheKey, Utilities.IsDevelopment ? TimeSpan.FromMinutes(5) : TimeSpan.FromHours(1));
_maxZScoreCache.SetCacheItem(async set =>
_maxZScoreCache.SetCacheItem(async (set, token) =>
{
var validPlayTime = _configurationHandler.Configuration()?.TopPlayersMinPlayTime ?? 3600 * 3;
@ -78,7 +78,7 @@ namespace Stats.Client
.Where(AdvancedClientStatsResourceQueryHelper.GetRankingFunc(validPlayTime))
.Where(s => s.Skill > 0)
.Where(s => s.EloRating > 0)
.MaxAsync(s => (double?)s.ZScore);
.MaxAsync(s => (double?)s.ZScore, token);
return zScore ?? 0;
}, MaxZScoreCacheKey, Utilities.IsDevelopment ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(30));