Documentation
¶
Overview ¶
Package singleflight provides a mechanism to suppress duplicate function calls. When multiple goroutines call Group.Do with the same key, only the first call executes the function; subsequent callers block and share the result.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group manages deduplicated function calls keyed by string.
func NewGroup ¶
func NewGroup() *Group
NewGroup creates a new Group ready to track deduplicated calls.
func (*Group) Do ¶
Do executes fn for the given key, ensuring that concurrent callers with the same key share the same result. Returns the value, whether this call shared the result with another in-flight call, and an error.
Click to show internal directories.
Click to hide internal directories.