Help us shape the future of Go! Take the 2026 Go Developer Survey

singleflight

package
v1.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

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 是 singleflight 的主数据结构,管理不同 key 的请求(call)。

func NewGroup

func NewGroup() *Group

func (*Group) Do

func (g *Group) Do(key string, fn func() (interface{}, error)) (interface{}, error)

Do 保证key所对应的fn函数同一时刻只会执行一次

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL