lockers

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-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 RedisDisLocker

type RedisDisLocker struct {
	// contains filtered or unexported fields
}

RedisDisLocker 基于redis的分布式锁

func NewRedisDisLocker

func NewRedisDisLocker(rds *redis.Client) (*RedisDisLocker, error)

func (*RedisDisLocker) Delay

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

Delay 延长锁 ttl: 秒级

func (*RedisDisLocker) Lock

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

Lock 尝试加锁 ttl: 秒级

func (*RedisDisLocker) Release

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

Release 释放锁

func (*RedisDisLocker) TTL

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

TTL 返回锁剩余时间 毫秒级

Jump to

Keyboard shortcuts

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