redisv8

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ErrRedisNotFound = redis.Nil

ErrRedisNotFound not exist in redis

Variables

View Source
var RedisClient *redis.Client

RedisClient redis 客户端

Functions

func Init

func Init(c *Config) *redis.Client

Init 实例化一个redis client

func InitTestRedis

func InitTestRedis()

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

func ScanRedisKeys added in v0.0.9

func ScanRedisKeys(client *redis.Client, scanCnt int64, matchRe *regexp.Regexp, sleepCnt int, sleepTime int, keysChan chan string) error

Types

type Config

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

Config redis config

type IDAlloc

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

func NewIDAlloc

func NewIDAlloc(conn *redis.Client) *IDAlloc

NewIDAlloc create new id alloc instance

func (*IDAlloc) GetCurrentID

func (ia *IDAlloc) GetCurrentID(key string) (int64, error)

func (*IDAlloc) GetKey

func (ia *IDAlloc) GetKey(key string) string

GetKey 获取key

func (*IDAlloc) GetNewID

func (ia *IDAlloc) GetNewID(key string, step int64) (int64, error)

Jump to

Keyboard shortcuts

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