redis

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Nil redis nil
	Nil = redis.Nil
	// Success redis成功标识
	Success = 1
)

Variables

This section is empty.

Functions

func GetClient

func GetClient(name string) *redis.Client

GetClient get a redis client

func InitTestRedis

func InitTestRedis() *redis.Client

InitTestRedis 实例化一个可以用于单元测试的redis

func NewClient

func NewClient(c *Config) (rdb *redis.Client, err error)

NewClient new a redis instance

Types

type Config

type Config struct {
	Url          string
	Addr         string
	Username     string
	Password     string
	DB           int
	MinIdleConn  int
	PoolSize     int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	PoolTimeout  time.Duration
	Trace        bool
}

Config redis config

type Manager

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

Manager define a redis manager

func GetManager

func GetManager() *Manager

GetManager get a redis manager

func NewManager added in v0.0.7

func NewManager() *Manager

NewManager create a redis manager

func (*Manager) GetClient

func (m *Manager) GetClient(name string) *redis.Client

GetClient get a redis client

func (*Manager) NewClient

func (m *Manager) NewClient(name string, c *Config)

NewClient new a redis client

Jump to

Keyboard shortcuts

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