valkey

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package valkey is a Valkey (Redis protocol) connection as a dependency: a configuration section, a client instrumented with the service's OpenTelemetry providers, a PING probe and a close.

type Config struct {
    config.Backplane `json:"backplane"`
    Cache valkey.Config `json:"cache"` // GREETER_CACHE_ADDR, ...
}

cache := deps.NewDependency(root, valkey.New(cfg.Cache), deps.Name("cache"))
err := cache.Get().Do(ctx, cache.Get().B().Set().Key("k").Value("v").Build()).Error()

The address is a seed: a cluster is discovered from it.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAddr = errors.New("valkey: addr is required")

ErrNoAddr: the section has no address.

Functions

func New

func New(cfg Config) deps.Provider[Client]

New is the provider of the client: Provide connects and pings, the probe pings, Close closes.

Types

type Client

type Client = valkeygo.Client

Client is valkey-go's client: commands are built with B() and sent with Do, DoMulti or DoCache.

type Config

type Config struct {
	// Addr is host:port of a node.
	Addr     string        `json:"addr,omitempty"`
	Username string        `json:"username,omitempty"`
	Password config.Secret `json:"password,omitempty"`
	// DB is the logical database (standalone only).
	DB  int64      `json:"db"  schemapb:"default=0;gte=0;lte=15"`
	TLS config.TLS `json:"tls"`
}

Config is the connection's section.

func (Config) Enabled

func (c Config) Enabled() bool

Enabled reports whether an address is set.

func (Config) Validate

func (c Config) Validate() error

Validate checks what the schema cannot: the address is set and the TLS material parses.

Jump to

Keyboard shortcuts

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