Skip to content

Improved concurrency in loader function.

Compare
Choose a tag to compare
@ReneKroon ReneKroon released this 26 May 19:53
· 59 commits to master since this release

#44 : There are no API changes, but a contribution was made to use https://pkg.go.dev/golang.org/x/sync/singleflight as a way to provide everybody waiting for a key with that result when it is fetched. Thanks go out to @jspri

This removes some complexity from the code and will make sure that all callers will get a return value even if there's high concurrency and low TTL (as proven by the test that was added).