Do flyweight patterns exist in coroutines?
For example, let's say I have 5 suspend methods that require a parameter, which can also be retrieved by a suspend method.
If I call two of them simultaneously, is there a way for me to have them wait on the same suspension?
One way of doing this would be to keep a map of keys to deferred values, where I assume that calling await twice will only run the logic once. Is there a better way of achieving that?
09/28/2018, 3:56 AM
That's literally what you get by using
and then calling
on the same deferred object
If you do a Lazy dispatched
you can spawn them all off immediately and then the