mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Rename ArchiCachable to ArchiCacheable (#963)
* Fix NullReferenceException in AcceptConfirmations() * Rename ArchiCachable to ArchiCacheable
This commit is contained in:
committed by
Łukasz Domeradzki
parent
c39ada25ab
commit
ceb61945bf
@@ -1,4 +1,4 @@
|
||||
// _ _ _ ____ _ _____
|
||||
// _ _ _ ____ _ _____
|
||||
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||
@@ -61,8 +61,8 @@ namespace ArchiSteamFarm {
|
||||
}.ToImmutableDictionary();
|
||||
|
||||
private readonly Bot Bot;
|
||||
private readonly ArchiCachable<string> CachedApiKey;
|
||||
private readonly ArchiCachable<bool> CachedPublicInventory;
|
||||
private readonly ArchiCacheable<string> CachedApiKey;
|
||||
private readonly ArchiCacheable<bool> CachedPublicInventory;
|
||||
private readonly SemaphoreSlim SessionSemaphore = new SemaphoreSlim(1, 1);
|
||||
private readonly WebBrowser WebBrowser;
|
||||
|
||||
@@ -75,8 +75,8 @@ namespace ArchiSteamFarm {
|
||||
internal ArchiWebHandler(Bot bot) {
|
||||
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
|
||||
|
||||
CachedApiKey = new ArchiCachable<string>(ResolveApiKey, TimeSpan.FromHours(1));
|
||||
CachedPublicInventory = new ArchiCachable<bool>(ResolvePublicInventory, TimeSpan.FromHours(1));
|
||||
CachedApiKey = new ArchiCacheable<string>(ResolveApiKey, TimeSpan.FromHours(1));
|
||||
CachedPublicInventory = new ArchiCacheable<bool>(ResolvePublicInventory, TimeSpan.FromHours(1));
|
||||
WebBrowser = new WebBrowser(bot.ArchiLogger, Program.GlobalConfig.WebProxy);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// _ _ _ ____ _ _____
|
||||
// _ _ _ ____ _ _____
|
||||
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||
@@ -24,7 +24,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArchiSteamFarm.Helpers {
|
||||
internal sealed class ArchiCachable<T> : IDisposable {
|
||||
internal sealed class ArchiCacheable<T> : IDisposable {
|
||||
private readonly TimeSpan CacheLifetime;
|
||||
private readonly SemaphoreSlim InitSemaphore = new SemaphoreSlim(1, 1);
|
||||
private readonly Func<Task<(bool Success, T Result)>> ResolveFunction;
|
||||
@@ -40,7 +40,7 @@ namespace ArchiSteamFarm.Helpers {
|
||||
private T InitializedValue;
|
||||
private Timer MaintenanceTimer;
|
||||
|
||||
internal ArchiCachable(Func<Task<(bool Success, T Result)>> resolveFunction, TimeSpan? cacheLifetime = null) {
|
||||
internal ArchiCacheable(Func<Task<(bool Success, T Result)>> resolveFunction, TimeSpan? cacheLifetime = null) {
|
||||
ResolveFunction = resolveFunction ?? throw new ArgumentNullException(nameof(resolveFunction));
|
||||
CacheLifetime = cacheLifetime ?? Timeout.InfiniteTimeSpan;
|
||||
}
|
||||
Reference in New Issue
Block a user