singleflight

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: MIT Imports: 3 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 interface {
	Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool)
	DoChan(key string, fn func() (interface{}, error)) <-chan singleflight.Result
}

type Job

type Job[T any] struct {
	WorkIdentify string
	CacheGetter  func() (*T, error)
	CacheSetter  func(*T) error
	OnceGetter   func() (*T, error)
}

func (Job[T]) DoWith

func (job Job[T]) DoWith(engine Group) (*T, error)

func (Job[T]) DoWithTimeout

func (job Job[T]) DoWithTimeout(engine Group, timeout time.Duration) (*T, error)

Jump to

Keyboard shortcuts

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