redis

package
v1.17.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const TTL = 300

TTL default redis ttl to cache

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode added in v1.17.0

type Mode string

Mode define the Redis connection mode supported

const (
	ModeStandalone Mode = "standalone"
	ModeSentinel   Mode = "sentinel"
	ModeCluster    Mode = "cluster"
)

type RedisConnection

type RedisConnection struct {
	Mode Mode

	Address string
	DB      int

	SentinelAddress []string
	MasterName      string

	ClusterAddress []string

	Password  string
	Protocol  int
	UseTLS    bool
	TLSConfig *tls.Config

	Logger    log.Logger
	Connected bool
	Client    redis.UniversalClient
}

RedisConnection this struct represent a Redis connection hub

func (*RedisConnection) Close added in v1.12.1

func (rc *RedisConnection) Close() error

Close closes the Redis connection

func (*RedisConnection) Connect

func (rc *RedisConnection) Connect(ctx context.Context) error

Connect initializes a Redis connection

func (*RedisConnection) GetClient

func (rc *RedisConnection) GetClient(ctx context.Context) (redis.UniversalClient, error)

GetClient always returns a pointer to a Redis client

Jump to

Keyboard shortcuts

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