redis

package
v1.0.1194-e37b823 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package redis contains wiring and observability for the go-redis Redis client.

There is support for: - observability (both for queries and connection info) - health checks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(o Options, sys *system.System) *redis.Client

Load will create a new Redis client, and wire it into the provided System with default lifecycle management and observability.

func New

func New(o Options) *redis.Client

New will only construct a new Redis client with the provided options. It is the caller's responsibility to close it at the right time.

Types

type HealthCheck

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

func NewHealthCheck

func NewHealthCheck(client *redis.Client) *HealthCheck

func (*HealthCheck) HealthChecks

func (r *HealthCheck) HealthChecks() (name string, ready, live func(ctx context.Context) error)

type Metrics

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

func NewMetrics

func NewMetrics(name string, client *redis.Client) *Metrics

func (*Metrics) Gauges

func (r *Metrics) Gauges(_ context.Context) map[string]float64

func (*Metrics) MetricName

func (r *Metrics) MetricName() string

type Options

type Options struct {
	Host     string
	Port     int
	User     string
	Password secret.String
	DB       int

	// Optional
	TLS    bool
	CAFunc func() *x509.CertPool
}

Jump to

Keyboard shortcuts

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