manredis

package
v0.0.0-...-2d87608 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnFailed = errors.New("connect redis failed.")

连接失败定义的错误

View Source
var ErrRedisIPIsEmpty = errors.New("input redis ip is empty.")

定义错误 ErrRedisIPIsEmpty 连接传入的RedisIP为空 则使用这个错误 使用该错误信息的地方需要panic()

View Source
var ErrSSHInfoIsEmpty = errors.New("input ssh info is empty.")

定义错误 ErrSSHInfoIsEmpty 使用了ssh通道连接redis,没有传入连接ssh的主机,密码 则使用这个错误 使用该错误信息的地方需要panic()

Functions

This section is empty.

Types

type RedisGo

type RedisGo struct {

	//	redis连接地址
	RedisIP string

	//	redis连接端口,默认 6379
	RedisPort int

	//	redisn连接密码
	RedisPassword string

	//	使用ssh通道连接redis的 host地址
	SSHAddr string

	//	使用ssh通道连接redis的 host 账号
	SSHUser string

	//	使用ssh通道连接redis的 host 密码
	SSHPass string

	//	全局设置redis db, 默认连接为0, 非单独使用所强制指定可以不用在这里设置
	GlobalDBNumber int

	//	最大闲置数,用于redis连接池
	RedisMaxIdle int

	//	最大连接数,
	RedisMaxActive int

	//	单条连接Timeout
	RedisIdleTimeoutSec int
}

连接redis的结构体定义

func (*RedisGo) RConn

func (r *RedisGo) RConn() (redis.Conn, error)

RConn 普通连接 返回redis连接

func (*RedisGo) RPool

func (r *RedisGo) RPool() *redis.Pool

RPool 连接池连接 返回redis连接池 *redis.Pool.Get() 获取redis连接

func (*RedisGo) RSSHConn

func (r *RedisGo) RSSHConn() (redis.Conn, error)

RSSHConn SSH普通连接 返回redis连接

func (*RedisGo) RSSHPool

func (r *RedisGo) RSSHPool() *redis.Pool

RSSHPool SSH连接池连接

type StringCMD

type StringCMD struct{}

Jump to

Keyboard shortcuts

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