singleflight

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 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 Config

type Config struct {
	Golang *Golang
}

Config provides list of singleflight's vendor that can be used. It will prioritize from top to bottom and only choose one.

type Golang

type Golang struct {
	// contains filtered or unexported fields
}

Golang is config for golang's singleflight.

func (*Golang) Do

func (sf *Golang) Do(key string, workFn func() (interface{}, error)) (interface{}, error)

Do from Golang.

type Singleflight

type Singleflight interface {
	// Do runs the workFn with singleflight.
	Do(key string, workFn func() (interface{}, error)) (interface{}, error)
}

Singleflight provides list of standard's singleflight functions.

func New

func New(v Vendor, conf Config) (Singleflight, error)

New creates a singlflight base on selected vendor.

type Vendor

type Vendor string

Vendor as an alias.

const (
	GOLANG Vendor = "golang"
)

Consts

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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