redis_db

package
v0.10.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRedisURL added in v0.7.41

func ParseRedisURL(rawURL string, skipTLSVerify bool) (*redis.Options, error)

parseRedisURL parses a Redis URL into Redis options, handling various URL formats including Azure Redis Cache URLs with special characters in passwords.

Types

type Redis

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

Redis struct holds the Redis client and addresses of Redis instances. It supports both single-instance Redis connections and Redis Cluster setups.

func NewRedisClient

func NewRedisClient(addresses []string, skipTLSVerify bool) (*Redis, error)

NewRedisClient creates a new Redis client connection based on the provided list of addresses. It automatically detects if the connection is for a single Redis instance or a Redis Cluster.

Parameters: - addresses []string: A list of Redis addresses. For a single Redis instance, provide one address. - skipTLSVerify bool: Whether to skip TLS certificate verification

Returns: - *Redis: A new Redis client wrapper. - error: An error if the provided address is invalid or connection setup fails.

func (*Redis) Client

func (r *Redis) Client() redis.UniversalClient

Client returns the Redis universal client. It can be used directly for Redis operations like Get, Set, or Publish.

Returns: - redis.UniversalClient: The universal Redis client, which supports both standalone and clustered Redis instances.

func (*Redis) MakeRedisClient

func (r *Redis) MakeRedisClient() interface{}

MakeRedisClient returns the Redis client interface, allowing compatibility with other packages or tools.

Returns: - interface{}: The Redis client interface.

Jump to

Keyboard shortcuts

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