package flightcontrol
import "github.com/moby/buildkit/util/flightcontrol"
Index ¶
Types ¶
type CachedGroup ¶
type CachedGroup[T any] struct { // CacheError defines if error results should also be cached. // It is not safe to change this value after the first call to Do. // Context cancellation errors are never cached. CacheError bool // contains filtered or unexported fields }
Group is a flightcontrol synchronization group that memoizes the results of a function and returns the cached result if the function is called with the same key. Don't use with long-running groups as the results are cached indefinitely.
func (*CachedGroup[T]) Do ¶
func (g *CachedGroup[T]) Do(ctx context.Context, key string, fn func(ctx context.Context) (T, error)) (T, error)
Do executes a context function syncronized by the key or returns the cached result for the key.
type Group ¶
type Group[T any] struct { // contains filtered or unexported fields }
Group is a flightcontrol synchronization group
func (*Group[T]) Do ¶
func (g *Group[T]) Do(ctx context.Context, key string, fn func(ctx context.Context) (T, error)) (v T, err error)
Do executes a context function syncronized by the key
Source Files ¶
- Version
- v0.21.0 (latest)
- Published
- Apr 11, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 days ago –
Tools for package owners.