clredis

package
v0.32.6 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package clredis provides reusable components for using Redis

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	opts *redis.UniversalOptions, _ *zap.Logger, tp trace.TracerProvider, mtr metric.MeterProvider,
) (redis.UniversalClient, error)

New inits a universal client and instruments it if available.

func NewOptions

func NewOptions(cfg Config, logs *zap.Logger) (*redis.UniversalOptions, error)

NewOptions parses our environment config into options for the Redis client.

func Provide added in v0.17.0

func Provide() fx.Option

Provide configures the DI for providng database connectivity.

func TestProvide added in v0.17.0

func TestProvide() fx.Option

TestProvide configures the DI for a test environment.

Types

type Config

type Config struct {
	// Node addresses provide to the cluster client
	Addrs []string `env:"ADDRS" envDefault:"localhost:6379"`
	// Username for authenticated configuration
	Username string `env:"USERNAME"`
	// Password for authenticated configuration
	Password string `env:"PASSWORD"`
	// Enable tls
	EnableTLS bool `env:"ENABLE_TLS" envDefault:"false"`
	// Setting this enables TLS connections
	TLSServerName string `env:"TLS_SERVER_NAME"`
	// ClientName allows the application to indicate its name so connections can be more easily debugged
	ClientName string `env:"CLIENT_NAME" envDefault:"unknown"`
}

Config configures Redis through the environment.

type Logger

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

Logger logger implements: https://github.com/go-redis/redis/blob/86258a11a93291b817f420fff47e79bd22fcb4ca/redis.go

func NewLogger

func NewLogger(logs *zap.Logger) *Logger

NewLogger inits a Redis logger from a zap logger.

func (Logger) Printf

func (l Logger) Printf(_ context.Context, format string, v ...interface{})

Printf implements the redis logger.

Jump to

Keyboard shortcuts

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