redis

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstDbConnectTimeoutSec       = 10
	ConstHealthCheckStopTimeoutSec = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewRedisClient

func NewRedisClient(config *ClientConf) *Client

func (*Client) Close

func (c *Client) Close()

Close 这里优化了关闭顺序,优先健康监测关闭,要不然关闭出现监测失败 指针表示当前对象地址,没有指针表示数据副本是一个copy

func (*Client) HealthCheck

func (c *Client) HealthCheck() error

type ClientConf

type ClientConf struct {
	Address      string `json:"address" yaml:"address"`
	Port         uint16 `json:"port" yaml:"port"`
	ReadTimeout  uint32 `json:"readTimeout,omitempty" yaml:"readTimeout,omitempty"`
	WriteTimeout uint32 `json:"writeTimeout,omitempty" yaml:"writeTimeout,omitempty"`
	Password     string `json:"password" yaml:"password"`
	DB           uint8  `json:"db" yaml:"db"`
	MinIdle      int    `json:"minIdle,omitempty" yaml:"minIdle,omitempty"`
	MaxOpen      int    `json:"maxOpen,omitempty" yaml:"maxOpen,omitempty"`
}

Jump to

Keyboard shortcuts

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