valkey

package
v2.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package valkey provides atomic bounded-use consumption through one Valkey EVAL operation. Client libraries adapt their result type to Evaler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumptionStore

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

ConsumptionStore atomically consumes bounded capabilities in Valkey.

func NewConsumptionStore

func NewConsumptionStore(options Options) (*ConsumptionStore, error)

NewConsumptionStore validates a client and fixed key prefix.

func (*ConsumptionStore) Consume

Consume executes one constant script against one declared, digest-derived key.

type Evaler

type Evaler interface {
	Eval(context.Context, string, []string, ...string) ([]string, error)
}

Evaler executes one script with every accessed key declared in keys and normalizes the RESP array reply to strings. Implementations must preserve context cancellation and must not retry writes after unknown outcomes.

type Options

type Options struct {
	// LegacyIssuer is the explicit owner-proven namespace of the ID-only ledger
	// under KeyPrefix. It is required even for a new empty ledger. All old writers
	// must be fenced before activation; unknown ownership requires retirement.
	LegacyIssuer string
	Client       Evaler
	KeyPrefix    string
}

Options configures Valkey key ownership.

Jump to

Keyboard shortcuts

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