redislock

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package redislock provides a Redsync (Redis) backed lock.DistributedLock.

It is an optional driver kept out of pkg/lock so that local/in-memory embedding does not pull in redsync / go-redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisLock

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

RedisLock is a Redsync-backed distributed lock (recommended for production).

func New

func New(redisClient *redis.Client) *RedisLock

New builds a Redis-backed distributed lock over the given client.

func (*RedisLock) Lock

func (l *RedisLock) Lock(ctx context.Context, key string, timeout time.Duration) (bool, func(), error)

Lock 抢占分布式锁

Jump to

Keyboard shortcuts

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