diff --git a/Directory.Build.props b/Directory.Build.props index 7effae0..d1c9920 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 2.1.0 + 2.1.1 enable net6.0 true diff --git a/FastGithub.DomainResolve/DnsClient.cs b/FastGithub.DomainResolve/DnsClient.cs index c87478f..2301373 100644 --- a/FastGithub.DomainResolve/DnsClient.cs +++ b/FastGithub.DomainResolve/DnsClient.cs @@ -31,7 +31,7 @@ namespace FastGithub.DomainResolve private readonly ILogger logger; private readonly ConcurrentDictionary semaphoreSlims = new(); - private readonly IMemoryCache dnsCache = new MemoryCache(Options.Create(new MemoryCacheOptions())); + private readonly IMemoryCache dnsLookupCache = new MemoryCache(Options.Create(new MemoryCacheOptions())); private readonly TimeSpan minTimeToLive = TimeSpan.FromSeconds(30d); private readonly TimeSpan maxTimeToLive = TimeSpan.FromMinutes(10d); @@ -118,13 +118,13 @@ namespace FastGithub.DomainResolve try { - if (this.dnsCache.TryGetValue>(key, out var value)) + if (this.dnsLookupCache.TryGetValue>(key, out var value)) { return value; } var result = await this.LookupCoreAsync(dns, endPoint, fastSort, cancellationToken); - return this.dnsCache.Set(key, result.Addresses, result.TimeToLive); + return this.dnsLookupCache.Set(key, result.Addresses, result.TimeToLive); } catch (OperationCanceledException) { @@ -133,12 +133,12 @@ namespace FastGithub.DomainResolve catch (SocketException ex) { this.logger.LogWarning($"{endPoint.Host}@{dns}:{ex.Message}"); - return this.dnsCache.Set(key, Array.Empty(), this.minTimeToLive); + return this.dnsLookupCache.Set(key, Array.Empty(), this.minTimeToLive); } catch (Exception ex) { this.logger.LogWarning($"{endPoint.Host}@{dns}:{ex.Message}"); - return this.dnsCache.Set(key, Array.Empty(), this.minTimeToLive); + return Array.Empty(); } finally {