lockers

package
v1.1.45 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

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) Delay

func (l *RedisDisLocker) Delay(key string, ttl int64) error

ttl: 秒级

func (*RedisDisLocker) Lock

func (l *RedisDisLocker) Lock(key string, ttl int64) (bool, error)

ttl: 秒级

func (*RedisDisLocker) Release

func (l *RedisDisLocker) Release(key string) error

func (*RedisDisLocker) TTL

func (l *RedisDisLocker) TTL(key string) (int64, error)

返回 毫秒级

Jump to

Keyboard shortcuts

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