Documentation ¶
Overview ¶
Package singleflight provides a mechanism to suppress duplicate Get() calls for a given key.
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
}
func (*Group) Do ¶
func (g *Group) Do(key string, f func() ([]byte, lifetime.Lifetime, error)) (bool, []byte, lifetime.Lifetime, error)
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a call comes in for the same key, the duplicate caller waits for the original to complete and receives the same result. The first parameter indicates whether the call was deduplicated, and will be true for all but the first concurrent caller.
Click to show internal directories.
Click to hide internal directories.