Skip to content

Commit

Permalink
Merge pull request #1 from cdoky/master
Browse files Browse the repository at this point in the history
fixed: 只会读第一个不为空的`Cacheable`
  • Loading branch information
yangKJ committed Jan 10, 2024
2 parents 50cf654 + 84d27bb commit c0b6f15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ public final class Storage<T: Codable> {

/// Read disk data or memory data.
public func read(key: String, options: CachedOptions) -> Data? {
for named in options.cacheNameds() where self.caches[named] != nil {
return self.caches[named]!.read(key: key)
for named in options.cacheNameds() {
guard let value = self.caches[named]?.read(key: key) else {
continue
}
return value
}
return nil
}
Expand Down

0 comments on commit c0b6f15

Please sign in to comment.