valkey

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package valkey is the legacy valkey-go cache adapter.

Deprecated: use github.com/faustbrian/go-cache/v2/adapters/valkey. This package remains supported for the longer of 180 days after successor availability and two subsequently published stable root-module minor releases.

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 preserves the legacy Valkey adapter type identity.

func New

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

New validates config and constructs a Valkey backend.

func (*Backend) Delete

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

Delete removes key and reports whether Valkey deleted it.

func (*Backend) Get

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

Get reads and validates one bounded wire record.

func (*Backend) Set

func (backend *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 (backend *Backend) SetIfOwned(
	ctx context.Context,
	key string,
	record cache.Record,
	guard cache.OwnershipGuard,
) error

SetIfOwned atomically compares an active Valkey lease and publishes a record.

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