client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package redis 封装第三方库redigo

Index

Constants

This section is empty.

Variables

View Source
var NewClient = func(addr *util.DBAddress) Client {
	c := &redisCli{
		target:       addr.Conn.DSN,
		password:     addr.Conn.Password,
		readTimeout:  time.Duration(addr.ReadTimeout) * time.Millisecond,
		writeTimeout: time.Duration(addr.WriteTimeout) * time.Millisecond,
	}

	c.pool = getPool(addr.Conn.DSN, addr.Conn.Password)
	return c
}

NewClient 新建一个redis后端请求代理

Functions

This section is empty.

Types

type Client

type Client interface {
	Do(ctx context.Context, cmd string, args ...interface{}) (interface{}, error)
}

Client redis请求接口

type Options

type Options struct {
	MaxIdle         int           // 最大空闲连接数
	MaxActive       int           // 最大活跃连接数
	IdleTimeout     time.Duration // 最大空闲时间
	MaxConnLifetime time.Duration // 最大连接生存时间
	DefaultTimeout  time.Duration // 默认连接超时和读写超时
	IsWait          bool          // 设置连接池用尽时是否等待空闲连接
}

Jump to

Keyboard shortcuts

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