mredis

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

catredis

全局通用的 Redis 和 Redsync 变量。

用法

Redis 用法如下:

c := catredis.Pool.Get()
defer c.Close()

_, err := c.Do("ZADD", consts.GoldTopRedisKey, -amount, userID)

return err

Redsync 分布式锁的用法如下:

mutex := catredis.RedLock.NewMutex(fmt.Sprintf("%s%d", consts.RedLockCatMovePrefix, userID))
if err := mutex.Lock(); err != nil {
  return err
}
defer mutex.Unlock()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Pool    *meRedis
	RedLock *redsync.Redsync
)

Functions

func Setup

func Setup(conf *config.Configuration)

Types

This section is empty.

Jump to

Keyboard shortcuts

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