syncx

package
v0.0.0-...-c124da1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package syncx provides concurrency helpers: single-flight groups and cooperative cancellation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group[T any] struct {
	// contains filtered or unexported fields
}

Group is a generic single-flight group that suppresses duplicate in-flight calls for the same key.

func (*Group[T]) Do

func (g *Group[T]) Do(ctx context.Context, key string, fn func(context.Context) (T, error)) (value T, shared bool, err error)

Do executes fn for key, sharing the result with concurrent callers for the same key.

func (*Group[T]) Forget

func (g *Group[T]) Forget(key string)

Jump to

Keyboard shortcuts

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