From fdd9fa0e4531ea312cf68fcc208ada08fab85e99 Mon Sep 17 00:00:00 2001 From: swiftty <62803132+swiftty@users.noreply.github.com> Date: Wed, 13 May 2026 10:12:26 +0900 Subject: [PATCH 1/3] fix: fix various typos in Cache, DiskCache and LRUCache - onMemery -> onMemory in Cache.swift - peformChange -> performChange in DiskCache.swift - Entiries -> Entries in LRUCache.swift --- Generated-by: google/gemma-4-26b-a4b Co-authored-by: Claude --- Sources/DataCacheKit/Cache.swift | 14 +++++++------- Sources/DataCacheKit/DiskCache.swift | 4 ++-- Sources/LRUCache/LRUCache.swift | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Sources/DataCacheKit/Cache.swift b/Sources/DataCacheKit/Cache.swift index cef8ba3..3c77026 100644 --- a/Sources/DataCacheKit/Cache.swift +++ b/Sources/DataCacheKit/Cache.swift @@ -21,13 +21,13 @@ public actor Cache: Caching } } - private let onMemery: MemoryCache + private let onMemory: MemoryCache private let onDisk: DiskCache private var queueingTask: Task? public init(options: Options, logger: Logger = .init(.disabled)) { - self.onMemery = .init(options: options.forMemory, logger: logger) + self.onMemory = .init(options: options.forMemory, logger: logger) self.onDisk = .init(options: options.forDisk, logger: logger) self.options = options self.logger = logger @@ -40,7 +40,7 @@ public actor Cache: Caching public func value(for key: Key) async throws -> Value? { _ = await queueingTask?.result - if let value = await onMemery.value(for: key) { + if let value = await onMemory.value(for: key) { return value } @@ -53,7 +53,7 @@ public actor Cache: Caching return try decoder.decode(Value.self, from: data) }() - await onMemery.store(value, for: key).value + await onMemory.store(value, for: key).value return value } @@ -68,7 +68,7 @@ public actor Cache: Caching private func _store(_ value: Value, for key: Key) -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemery.store(value, for: key).value + async let memory: Void = await onMemory.store(value, for: key).value async let disk: Void = await _storeToDisk(value, for: key) await memory @@ -87,7 +87,7 @@ public actor Cache: Caching private func _remove(for key: Key) -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemery.remove(for: key).value + async let memory: Void = await onMemory.remove(for: key).value async let disk: Void = await onDisk.remove(for: key).value await memory @@ -106,7 +106,7 @@ public actor Cache: Caching private func _removeAll() -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemery.removeAll().value + async let memory: Void = await onMemory.removeAll().value async let disk: Void = await onDisk.removeAll().value await memory diff --git a/Sources/DataCacheKit/DiskCache.swift b/Sources/DataCacheKit/DiskCache.swift index f41fcd3..b85e951 100644 --- a/Sources/DataCacheKit/DiskCache.swift +++ b/Sources/DataCacheKit/DiskCache.swift @@ -272,7 +272,7 @@ extension DiskCache { group.addTask { [change] } continue } - let task = peformChange(change, with: url) + let task = performChange(change, with: url) group.addTask { do { try await task.value @@ -292,7 +292,7 @@ extension DiskCache { } } - private func peformChange(_ change: Staging.Change, with url: URL) -> Task { + private func performChange(_ change: Staging.Change, with url: URL) -> Task { let task = Task { do { switch change.operation { diff --git a/Sources/LRUCache/LRUCache.swift b/Sources/LRUCache/LRUCache.swift index 1e242ed..f9719fe 100644 --- a/Sources/LRUCache/LRUCache.swift +++ b/Sources/LRUCache/LRUCache.swift @@ -12,7 +12,7 @@ public struct LRUCache: ~Copyable, Se nonmutating set { entries.withLock { $0.countLimit = newValue } } } - private let entries = OSAllocatedUnfairLock(initialState: .init()) + private let entries = OSAllocatedUnfairLock(initialState: .init()) public init() {} @@ -45,8 +45,8 @@ public struct LRUCache: ~Copyable, Se } public func removeAllValues() { - entries.withLock { entiries in - entiries.removeAll() + entries.withLock { entries in + entries.removeAll() } } } @@ -83,7 +83,7 @@ private extension LRUCache { } } - struct Entiries: Sendable { + struct Entries: Sendable { var values: [Key: CacheEntry] = [:] var totalCost = 0 var totalCostLimit = 0 From 8bdbf1858423705d8a216bdcf9f7f5eebe3ef8ce Mon Sep 17 00:00:00 2001 From: swiftty <62803132+swiftty@users.noreply.github.com> Date: Wed, 13 May 2026 11:13:43 +0900 Subject: [PATCH 2/3] fix: fix typo in log message - sweeped -> swept in DiskCache.swift --- Generated-by: google/gemma-4-26b-a4b Co-authored-by: Claude --- Sources/DataCacheKit/DiskCache.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/DataCacheKit/DiskCache.swift b/Sources/DataCacheKit/DiskCache.swift index b85e951..7a91119 100644 --- a/Sources/DataCacheKit/DiskCache.swift +++ b/Sources/DataCacheKit/DiskCache.swift @@ -378,7 +378,7 @@ extension DiskCache { try FileManager.default.removeItem(at: item.url) size -= item.meta.totalFileAllocatedSize ?? 0 logger.debug( - "\(self.logKey)sweeped item: \(item.url.lastPathComponent), size: \(item.meta.totalFileAllocatedSize ?? 0)" + "\(self.logKey)swept item: \(item.url.lastPathComponent), size: \(item.meta.totalFileAllocatedSize ?? 0)" ) return true } catch { From db225f69a584b3385f16554f0231fd212a74f720 Mon Sep 17 00:00:00 2001 From: swiftty <62803132+swiftty@users.noreply.github.com> Date: Wed, 13 May 2026 11:18:21 +0900 Subject: [PATCH 3/3] Remove await on async let --- Sources/DataCacheKit/Cache.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/DataCacheKit/Cache.swift b/Sources/DataCacheKit/Cache.swift index 3c77026..ae43374 100644 --- a/Sources/DataCacheKit/Cache.swift +++ b/Sources/DataCacheKit/Cache.swift @@ -68,8 +68,8 @@ public actor Cache: Caching private func _store(_ value: Value, for key: Key) -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemory.store(value, for: key).value - async let disk: Void = await _storeToDisk(value, for: key) + async let memory: Void = onMemory.store(value, for: key).value + async let disk: Void = _storeToDisk(value, for: key) await memory await disk @@ -87,8 +87,8 @@ public actor Cache: Caching private func _remove(for key: Key) -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemory.remove(for: key).value - async let disk: Void = await onDisk.remove(for: key).value + async let memory: Void = onMemory.remove(for: key).value + async let disk: Void = onDisk.remove(for: key).value await memory await disk @@ -106,8 +106,8 @@ public actor Cache: Caching private func _removeAll() -> Task { queueingTask.enqueueAndReplacing { [weak self] in guard let self else { return } - async let memory: Void = await onMemory.removeAll().value - async let disk: Void = await onDisk.removeAll().value + async let memory: Void = onMemory.removeAll().value + async let disk: Void = onDisk.removeAll().value await memory await disk