Rename ArchiCachable to ArchiCacheable (#963)

* Fix NullReferenceException in AcceptConfirmations()

* Rename ArchiCachable to ArchiCacheable
This commit is contained in:
Vital7
2018-12-16 01:08:09 +03:00
committed by Łukasz Domeradzki
parent c39ada25ab
commit ceb61945bf
2 changed files with 8 additions and 8 deletions

View File

@@ -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);
}

View File

@@ -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;
}