Tips of Golang Sync

2019-03-12  本文已影响0人  forks1990

If a cache requires heavy computation or must be done once, use singleflight: https://godoc.org/golang.org/x/sync/singleflight

If multiple goroutine requests the same item, only send one request, other goroutine blocked and the same result returned.

上一篇 下一篇

猜你喜欢

热点阅读