summaryrefslogtreecommitdiff
path: root/DomainDig/LookupRuntime.swift
diff options
context:
space:
mode:
Diffstat (limited to 'DomainDig/LookupRuntime.swift')
-rw-r--r--DomainDig/LookupRuntime.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/DomainDig/LookupRuntime.swift b/DomainDig/LookupRuntime.swift
index b70a134..08ea122 100644
--- a/DomainDig/LookupRuntime.swift
+++ b/DomainDig/LookupRuntime.swift
@@ -58,6 +58,13 @@ actor LookupRuntime {
private var inFlight: [RequestKey: Task<CachedPayload, Never>] = [:]
private var nextAllowedAt: [RateLimitBucket: Date] = [:]
+ func clearCache() {
+ cache.removeAll()
+ inFlight.values.forEach { $0.cancel() }
+ inFlight.removeAll()
+ nextAllowedAt.removeAll()
+ }
+
func dns(domain: String) async -> CachedLookupResult<ServiceResult<[DNSSection]>> {
await execute(
key: .domain(domain, .dns),