redisop

package
v1.1.1-0...-42763b9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnection = errors.New("redisop: no connection")
	ErrNoSubscribe  = errors.New("redisop: no subscribe")
)

common errors

Functions

func SetLogger

func SetLogger(info Logger)

SetLogger set redisop info output

Types

type DefaultLogger

type DefaultLogger struct {
	Level int
	// contains filtered or unexported fields
}

DefaultLogger implement default logger interface

func NewDefaultLogger

func NewDefaultLogger(level string) *DefaultLogger

NewDefaultLogger init new default logger

func (DefaultLogger) Debug

func (l DefaultLogger) Debug(format string, v ...interface{})

Debug debug message

func (DefaultLogger) Info

func (l DefaultLogger) Info(format string, v ...interface{})

Info info message

func (DefaultLogger) Warning

func (l DefaultLogger) Warning(format string, v ...interface{})

Warning warning message

type Logger

type Logger interface {
	Warning(format string, v ...interface{})
	Info(format string, v ...interface{})
	Debug(format string, v ...interface{})
}

Logger logger interface use by this lib

type PubSubHandle

type PubSubHandle func(channel, kind string, data []byte)

PubSubHandle 处理redis订阅消息

type RedisPool

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

RedisPool redis连接池

func (*RedisPool) Close

func (p *RedisPool) Close() (ok bool)

Close 关闭连接池

func (*RedisPool) Connect

func (p *RedisPool) Connect(redisServer string) (ok bool)

Connect 连接redis服务器

func (*RedisPool) GetNotifyConfig

func (p *RedisPool) GetNotifyConfig() (cfg string)

GetNotifyConfig 获取redis事件通知配置

func (*RedisPool) IsConnected

func (p *RedisPool) IsConnected() (ok bool)

IsConnected 是否正常连接到服务器

func (*RedisPool) Rdo

func (p *RedisPool) Rdo(commandName string, args ...interface{}) (reply interface{}, err error)

Rdo 执行redis命令

func (*RedisPool) SetNotifyConfig

func (p *RedisPool) SetNotifyConfig(cfg string) (err error)

SetNotifyConfig 设置redis事件通知配置

func (*RedisPool) Subscribe

func (p *RedisPool) Subscribe(topic string, isPattern ...bool) (err error)

Subscribe 订阅

func (*RedisPool) SubscribeHandle

func (p *RedisPool) SubscribeHandle(handle PubSubHandle) (err error)

SubscribeHandle 处理redis订阅消息

func (*RedisPool) UnSubscribe

func (p *RedisPool) UnSubscribe(topic string, isPattern ...bool) (err error)

UnSubscribe 取消订阅

type RedisPoolX

type RedisPoolX struct {
	RedisPool
	// contains filtered or unexported fields
}

RedisPoolX 支持哨兵

func (*RedisPoolX) Sentinel

func (p *RedisPoolX) Sentinel(servers, masterName string) (err error)

Sentinel 连接哨兵服务器

Jump to

Keyboard shortcuts

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