singleflight

package
v0.3.3-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: Apache-2.0 Imports: 2 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 stores all calls in flight.

func NewGroup

func NewGroup(mapSize int) *Group

NewGroup returns a new Group holder with given mapSize.

func (*Group) Call

func (g *Group) Call(ctx context.Context, key string, fn func(ctx context.Context) (interface{}, error)) (interface{}, error)

Call will call fn in single-flight mode.

func (*Group) Delete

func (g *Group) Delete(key string)

Delete removes the flight of key so a new flight will start.

func (*Group) DeleteAll

func (g *Group) DeleteAll()

DeleteAll removes all flights.

Jump to

Keyboard shortcuts

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