redis

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instrument

func Instrument(hook Instrumentation)

Instrument registers a hook run against every client this package builds.

Called from the init of the module holding it, so that linking the module is the whole of the wiring. More than one is allowed, run in the order they were registered, since tracing and metrics are commonly separate hooks.

func New

func New(ref resources.Ref, creds Credentials) (cache.Client, error)

New returns a cache reached over Redis, built from what the deployment recorded about it.

Credentials may be nil, which is a cache reached with a recorded password or with none. Nothing is read and no connection is made here, a handle is taken during registration, before an event has arrived.

Types

type Closeable

type Closeable interface {
	cache.Client
	Close() error
}

Closeable is a cache client that also hands back the connection it holds, which is what New returns.

Separate from cache.Client because closing a cache is not something a handler does: a handle is taken during registration and held for the life of the process, and what gives the sockets back is the application shutting down, which the provider module handles.

type Credentials

type Credentials interface {
	// Secret reads a password the deployment recorded by reference rather than
	// by value, from wherever that platform keeps one.
	Secret(ctx context.Context, id string) (string, error)
	// SignedPassword mints a fresh password per connection, for a cache reached
	// with the platform's own identity rather than with a password. Nil says
	// the platform doesn't support obtaining signed passwords.
	//
	// This is per connection rather than once, because a signed token is shorter-lived
	// than the execution environment that holds the pool.
	SignedPassword(host, user, region string) func(context.Context) (string, string, error)
}

Credentials is how a cache's password is obtained on a platform where the deployment did not record a literal one.

type Instrumentation

type Instrumentation func(goredis.UniversalClient) error

Instrumentation is given a client before anything is sent through it.

Directories

Path Synopsis
otel module

Jump to

Keyboard shortcuts

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