redigo

package
v0.0.0-...-13c8884 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenLockKey

func GenLockKey(key string) string

func HealthCheck

func HealthCheck() error

func Init

func Init()

func InitByCfg

func InitByCfg(cfg map[string]RedisCfgArr)

func InitByData

func InitByData(data []byte)

func InitByFile

func InitByFile(fileName string)

func Lock

func Lock(key string, lockSec int, conn *RedisConn) bool

locker

func Unlock

func Unlock(key string, conn *RedisConn)

Types

type RedisCfg

type RedisCfg struct {
	Addr     string `json:"address"`
	Port     int    `json:"port"`
	Pwd      string `json:"pwd"`
	MaxIdle  int    `json:"maxIdle"`
	MaxTotal int    `json::maxTotal"`
}

redis config

func (RedisCfg) GetHost

func (this RedisCfg) GetHost() string

type RedisCfgArr

type RedisCfgArr struct {
	CfgArr []RedisCfg `json:"cfg"`
	UseNum int        `json:"useNum"`
}

type RedisConn

type RedisConn struct {
	redis.Conn
}

type RedisMgr

type RedisMgr struct {
	Cfgs     map[string]RedisCfgArr
	MapPools map[string]RedisPools
}

func NewRedisMgr

func NewRedisMgr() *RedisMgr

func (*RedisMgr) GetRedisPools

func (this *RedisMgr) GetRedisPools(name string) *RedisPools

func (*RedisMgr) HealthCheck

func (this *RedisMgr) HealthCheck() error

func (*RedisMgr) InitByCfg

func (this *RedisMgr) InitByCfg(cfg map[string]RedisCfgArr)

func (*RedisMgr) InitByData

func (this *RedisMgr) InitByData(data []byte)

func (*RedisMgr) InitByFile

func (this *RedisMgr) InitByFile(fileName string)

type RedisPool

type RedisPool struct {
	*redis.Pool
}

func CreatePools

func CreatePools(cfgs []RedisCfg, num int) []*RedisPool

func CreateRedisPool

func CreateRedisPool(server, password string, maxActive, maxIdle int) *RedisPool

func CreateRedisPoolByCfg

func CreateRedisPoolByCfg(cfg RedisCfg) *RedisPool

func CreateRedisPoolByFile

func CreateRedisPoolByFile(cfgFile string) *RedisPool

func (*RedisPool) Get

func (this *RedisPool) Get() *RedisConn

type RedisPools

type RedisPools []*RedisPool

func GetRedisPools

func GetRedisPools(name string) *RedisPools

func (RedisPools) GetConn

func (this RedisPools) GetConn() *RedisConn

func (RedisPools) GetConnByIndex

func (this RedisPools) GetConnByIndex(index int) *RedisConn

func (RedisPools) GetConnByRand

func (this RedisPools) GetConnByRand() *RedisConn

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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