valkey

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package valkey adapts valkey-go clients to the cache backend contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Backend implements cache.Backend with valkey-go.

func New

func New(config Config) (*Backend, error)

New validates config and constructs a Valkey backend.

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, key string) (bool, error)

Delete removes key and reports whether Valkey deleted it.

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key string) (cache.Record, bool, error)

Get reads and validates one bounded wire record.

func (*Backend) Set

func (b *Backend) Set(
	ctx context.Context,
	key string,
	record cache.Record,
	condition cache.Condition,
) (bool, error)

Set atomically writes a record with its stale deadline as server expiry.

func (*Backend) SetIfOwned

func (b *Backend) SetIfOwned(
	ctx context.Context,
	key string,
	record cache.Record,
	guard cache.OwnershipGuard,
) error

SetIfOwned atomically compares an active Valkey lease hash and publishes the record. A missing, expired, or superseded lease returns ErrOwnershipLost.

type Config

type Config struct {
	Client        valkeyclient.CommandClient
	Clock         cache.Clock
	MaxRecordSize int
}

Config supplies the native client, clock, and maximum wire record size.

Jump to

Keyboard shortcuts

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