-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Say you have some logic that may return nil, but you don't want to cache nil... Is this something where we could do this?
cache.fetch(key, as: String) do
[nil, "string"].sample
endWith this, I specify that the value is String, but if it returns nil, then we don't cache it. Running it again would only cache if the value returns "string". However, doing this...
cache.fetch(key, as: String?) do
[nil, "string"].sample
endwould say that I allow a nil value, so cache whatever I get back, even if it's nil.
I think we can catch that at compile-time and alter the logic. But the question is, would that be nice? Or would that cause issues?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels