I currently have a number of places where I request a specific URL. It would be nice if any concurrent requests would be de-duplicated so that any requests which are started while one is already in progress, joins the first and receives the same result.
I imagine that this would be similar to Go's singleflight: a collection wrapper around a Mutex, keyed on a string.
Does it really has to be keyed by a string? We are not in Go, you know, we can do much better.
Yeah agreed, although I do like the simplicity of a string. Using an inline class Key(val k: String) would work just as well though.
Most helpful comment
Does it really has to be keyed by a string? We are not in Go, you know, we can do much better.