redis

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 redis adapts go-redis/v9 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 go-redis/v9.

func New

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

New validates config and constructs a Redis backend.

func (*Backend) Delete

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

Delete removes key and reports whether Redis 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.

type Config

type Config struct {
	Client        redisclient.UniversalClient
	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