rediscli

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: AGPL-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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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