Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient struct { *redis.Client //redis客户端 // contains filtered or unexported fields }
func NewRedisClient ¶
func NewRedisClient(ctx context.Context, client *redis.Client) *RedisClient
*
- @Description: 初始化redis客户端
- @param ctx
- @param client
- @return *RedisClient
func (*RedisClient) GetLock ¶
func (r *RedisClient) GetLock(key string) *RedisLock
*
- @Description: 获取普通锁
- @receiver r
- @param key 锁
- @return *RedisLock
type RedisLock ¶
type RedisLock struct {
// contains filtered or unexported fields
}
func (*RedisLock) Lock ¶
*
- @Description: 上锁
- @receiver l
- @param block 是否阻塞获取
- @param expire 锁过期时间(设置0永不过期)
- @return bool
- @return error
func (*RedisLock) LockWaitSeconds ¶
*
- @Description: 限时上锁
- @receiver l
- @param waitSeconds 等待时长秒
- @param expireTime 锁过期时长
- @return bool
- @return error
Click to show internal directories.
Click to hide internal directories.