redis

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Nil = redis.Nil
View Source
var Refactor func(configName string, orgopts *Options) (opts *Options, err error)

Functions

This section is empty.

Types

type Client

type Client struct {
	redis.UniversalClient
	// contains filtered or unexported fields
}

Client redis客户端

func NewByConfig

func NewByConfig(configName string, setting config.Config, mapCfg map[string]any) (r *Client, err error)

NewByConfig 构建客户端

func NewByOpts

func NewByOpts(configName string, opts ...Option) (r *Client, err error)

NewByOpts 构建客户端

func (*Client) GetAddrs

func (c *Client) GetAddrs() []string

GetAddrs GetAddrs

type Option

type Option func(opts *Options)

func WithAddrs

func WithAddrs(addrs ...string) Option

func WithDbIndex

func WithDbIndex(index uint) Option

func WithDialTimeout

func WithDialTimeout(timeout uint) Option

func WithMapConfig added in v0.4.3

func WithMapConfig(cfg map[string]any) Option

func WithPassword

func WithPassword(password string) Option

func WithPoolSize

func WithPoolSize(poolSize uint) Option

func WithReadTimeout

func WithReadTimeout(timeout uint) Option

func WithUsername added in v0.1.40

func WithUsername(username string) Option

func WithWriteTimeout

func WithWriteTimeout(timeout uint) Option

type Options added in v0.3.1

type Options struct {
	Addrs        []string `json:"addrs,omitempty"  valid:"required" `
	Username     string   `json:"username,omitempty" `
	Password     string   `json:"password,omitempty" `
	DbIndex      uint     `json:"db,omitempty"`
	DialTimeout  uint     `json:"dial_timeout,omitempty"`
	ReadTimeout  uint     `json:"read_timeout,omitempty"`
	WriteTimeout uint     `json:"write_timeout,omitempty" `
	PoolSize     uint     `json:"pool_size,omitempty"`
}

Jump to

Keyboard shortcuts

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