rdb

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// RouteModeMasterOnly only route read-only commands to master node
	RouteModeMasterOnly = "master_only"
	// RouteModeMasterSlaveRandom route read-only commands to both master and slave, using random policy
	RouteModeMasterSlaveRandom = "master_slave_random"
	// RouteModeMasterSlaveLatency route read-only commands to both master and slave, using least latency policy
	RouteModeMasterSlaveLatency = "master_slave_latency"
)

Variables

This section is empty.

Functions

func Init

func Init(conf *Config)

Init initialize the redis cluster instance

func Uninit

func Uninit()

Uninit do the clean up for the global RedisConnectionManager instance

Types

type Client

type Client interface {
	redis.Cmdable
	Do(context context.Context, args ...interface{}) *redis.Cmd
	Process(context context.Context, cmd redis.Cmder) error
	Close() error
}

Client is the client interface for redis db

func Get

func Get() Client

Get return the rdb client instance

type Config

type Config struct {
	Addrs           []string
	DB              int
	Password        string
	ClusterEnabled  bool
	ReadOnly        bool
	RouteMode       string
	MaxRedirects    int
	MaxRetries      int
	MinRetryBackoff time.Duration
	MaxRetryBackoff time.Duration
	ConnectTimeout  time.Duration
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	PoolSize        int
	PoolTimeout     time.Duration
	MinIdleConns    int
	MaxIdleConns    int
	MaxActiveConns  int
	ConnMaxIdleTime time.Duration
	ConnMaxLifetime time.Duration
}

Config defines the redis config

Jump to

Keyboard shortcuts

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