valkey

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package valkey wraps a go-redis client used to share ephemeral server state across replicas (forge OAuth/CSRF state, board-MCP run tokens, auth rate-limit buckets). It supports a Sentinel-HA failover topology (the cloud posture) and a single-node URL (dev/local). The store implementations in pkg/server use the returned client directly; this package only owns construction + health.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a thin handle over a go-redis universal client.

func New

func New(opts Options) (*Client, error)

New builds a client. Sentinel HA when SentinelAddrs is set; otherwise a single-node client from URL. Errors when neither is configured.

func (*Client) Close

func (c *Client) Close() error

Close releases the connection pool.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping verifies connectivity (used by /readyz).

func (*Client) Redis

func (c *Client) Redis() redis.UniversalClient

Redis returns the underlying client for the store implementations.

type Options

type Options struct {
	// URL is a single-node connection string (redis://[:pass@]host:port[/db]).
	URL string
	// SentinelAddrs is the sentinel endpoint list for HA failover mode.
	SentinelAddrs []string
	// MasterName is the Sentinel-monitored master (required with SentinelAddrs).
	MasterName string
	// Password authenticates to the data nodes.
	Password string
	// SentinelPassword authenticates to the sentinels (defaults to Password).
	SentinelPassword string
}

Options configures the client. Sentinel mode wins when SentinelAddrs is set.

Jump to

Keyboard shortcuts

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