idempotency

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package idempotency provides idempotency utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStore

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

MemoryStore is an in-memory idempotency store intended for development/testing.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore constructs an in-memory idempotency store.

func (*MemoryStore) Get

Get returns an idempotency record if present and not expired.

func (*MemoryStore) Save

func (m *MemoryStore) Save(ctx context.Context, key string, record ports.IdempotencyRecord, ttl time.Duration) error

Save persists a completed idempotency record.

func (*MemoryStore) TryBegin

func (m *MemoryStore) TryBegin(ctx context.Context, key string, record ports.IdempotencyRecord, ttl time.Duration) (bool, error)

TryBegin reserves a key for an in-flight request.

Jump to

Keyboard shortcuts

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