cache

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cache provides Redis/Valkey persistence for idempotent operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

Client is implemented by go-redis standalone, Sentinel and cluster clients. The caller configures credentials, TLS, deadlines and retries, and owns Close.

type ConsistencyError

type ConsistencyError struct{ Err error }

func (*ConsistencyError) Error

func (e *ConsistencyError) Error() string

func (*ConsistencyError) Unwrap

func (e *ConsistencyError) Unwrap() error

type Options

type Options struct {
	StatusAttribute, ExpiryAttribute, InProgressExpiryAttribute string
	DataAttribute, ValidationAttribute                          string
	Now                                                         func() time.Time
	// OmitValidationOnSuccess reproduces the pinned TypeScript cache writer's
	// omission. Leave false to retain validation when replaying completed records.
	OmitValidationOnSuccess bool
}

type Store

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

func New

func New(client Client, options Options) (*Store, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) (idempotency.Record, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, record idempotency.Record, now time.Time) error

func (*Store) Update

func (s *Store) Update(ctx context.Context, record idempotency.Record) error

Jump to

Keyboard shortcuts

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