Documentation ¶
Index ¶
- Constants
- Variables
- func GetRedis(name string) *redis.Client
- func LoadRedis(name string, config Config)
- func TryLock(ctx context.Context, conn *redis.Client, key string, ex, lease int, ...) (context.CancelFunc, error)
- func UnLock(ctx context.Context, conn *redis.Client, cancelFunc context.CancelFunc, ...) (bool, error)
- type Config
- type LockError
Constants ¶
View Source
const ( InternalCodeFailed = 999 // 未取到锁 InternalCodeErr = 998 // 连接异常 InternalCodeLockNotOwn = 997 // 不是自己的锁 InternalCodeExLtLease = 996 // 有效期必须大于续租+minInterval时间 )
Variables ¶
View Source
var Cache = &cache{ pool: make(map[string]*redis.Client), }
Functions ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.