-
Notifications
You must be signed in to change notification settings - Fork 325
Cached transformed results in Cache
#1867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@swift-ci Please test |
Sources/SwiftExtensions/Cache.swift
Outdated
| let transformed = Task { try await transform(value.value) } | ||
| // Cache the transformed result. | ||
| storage[key] = transformed | ||
| return try await transformed.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this re-apply the transform for every subsequent access?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this was wrong on so many different levels. Thanks for catching it in the review, this would have been a pain to debug.
56155f8 to
2e756ac
Compare
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
The transform to get the transformed result might be expensive, so we should cache its result.
2e756ac to
1c1a1cf
Compare
|
@swift-ci Please test |
|
@swift-ci Please test Windows |
The transform to get the transformed result might be expensive, so we should cache its result.