client

package
v0.0.0-...-d07672d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstDatabaseConnectTimeout = 10000
	ConstHealthCheckInterval    = 5000
	ConstDatabaseReadTimeout    = 10000
	ConstDatabaseWriteTimeout   = 10000
	ConstProbeContextTimeout    = 5000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config 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"`                                         // DB的名称或编号
	MinIdle      int    `json:"minIdle,omitempty" yaml:"minIdle,omitempty"`           // 最小空闲连接数(针对于连接池)
	MaxOpen      int    `json:"maxOpen,omitempty" yaml:"maxOpen,omitempty"`           // 最大打开连接数(针对于连接池)
}

type FeatureOpts

type FeatureOpts struct {
	EnableMetrics bool `json:"enableMetrics,omitempty" yaml:"enableMetrics,omitempty"` // 开启 metrics 记录
}

func NewDefaultFeatureOpts

func NewDefaultFeatureOpts() *FeatureOpts

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewRedisClient

func NewRedisClient(clientConf *Config, featureOpts *FeatureOpts) *Pool

func (*Pool) GetSession

func (p *Pool) GetSession() *Session

func (*Pool) GetUnSafeClient

func (p *Pool) GetUnSafeClient() *redis.Client

func (*Pool) Stop

func (p *Pool) Stop()

type Session

type Session struct {
	*redis.Client
}

func (*Session) Close

func (s *Session) Close() error

Jump to

Keyboard shortcuts

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