idempotence

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultTimeout       = 5 * time.Second // 5 seconds
	DefaultSuccessfulTTL = 24 * time.Hour  // 24 hours
	StatusProcessing     = "processing"
	StatusProcessed      = "processed"
)

Variables

View Source
var ErrConflict = errors.New("conflict")

Functions

func WithDeploymentID added in v0.13.0

func WithDeploymentID(deploymentID string) func(opts *IdempotenceImplOptions)

func WithSuccessfulTTL

func WithSuccessfulTTL(successfulTTL time.Duration) func(opts *IdempotenceImplOptions)

func WithTimeout

func WithTimeout(timeout time.Duration) func(opts *IdempotenceImplOptions)

Types

type Idempotence

type Idempotence interface {
	Exec(ctx context.Context, key string, exec func(context.Context) error) error
}

func New

func New(redisClient redis.Cmdable, opts ...func(opts *IdempotenceImplOptions)) Idempotence

type IdempotenceImpl

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

func (*IdempotenceImpl) Exec

func (i *IdempotenceImpl) Exec(ctx context.Context, key string, exec func(context.Context) error) error

type IdempotenceImplOptions

type IdempotenceImplOptions struct {
	Timeout       time.Duration
	SuccessfulTTL time.Duration
	DeploymentID  string
}

Jump to

Keyboard shortcuts

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