rediscli

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WriteHandle is a variable of type `redis.UniversalClient` that represents the system wide redis pool (writes).
	WriteHandle redis.UniversalClient //nolint:gochecknoglobals // System wide redis pool

	// ReadHandle is a variable of type `redis.UniversalClient` that represents the system wide redis pool (reads).
	ReadHandle redis.UniversalClient //nolint:gochecknoglobals // System wide redis pool
)

Functions

func NewRedisClient

func NewRedisClient() (redisHandle redis.UniversalClient)

NewRedisClient creates a new Redis client based on the configuration settings. It checks whether a Redis cluster is specified in the configuration and creates a cluster client if so. If a Redis sentinel setup is specified in the configuration, it creates a failover client. For a standalone Redis setup, it creates a regular Redis client. The created Redis client is then returned as a universal client.

func NewRedisReplicaClient

func NewRedisReplicaClient() redis.UniversalClient

NewRedisReplicaClient is a function that returns a Redis replica client based on the configuration settings. If there are cluster addresses configured, it returns nil. If there are multiple sentinel addresses and a master address is configured, it returns a failover client. If the replica address is different from the master address, it returns a regular client using the replica address. Otherwise, it returns nil.

func RedisTLSOptions added in v1.3.2

func RedisTLSOptions(tlsCfg *config.TLS) *tls.Config

RedisTLSOptions checks if Redis TLS is enabled in the configuration. If TLS is enabled, it loads the X509 key pair and creates a tls.Config object. The loaded certificate is added to the tls.Config object. If an error occurs while loading the key pair, it logs the error and returns nil. If Redis TLS is disabled, it returns nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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