Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributeLocker ¶
type DistributeLocker interface { Lock(key string, ttl int64) (bool, error) Release(key string) error Delay(key string, ttl int64) error TTL(key string) (int64, error) }
DistributeLocker 分布式锁接口
func NewRedisDisLocker ¶
func NewRedisDisLocker(rds *redis.Client) (DistributeLocker, error)
type RedisDisLocker ¶
type RedisDisLocker struct {
// contains filtered or unexported fields
}
func (*RedisDisLocker) Lock ¶
func (l *RedisDisLocker) Lock(key string, ttl int64) (bool, error)
ttl: 秒级
func (*RedisDisLocker) Release ¶
func (l *RedisDisLocker) Release(key string) error
Click to show internal directories.
Click to hide internal directories.