rdb

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

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(args ...interface{}) *redis.Cmd
	Process(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
	MinIdleConns       int
	MaxConnAge         time.Duration
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency 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