redislock

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

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 redis SET NX based lock

func New

func New(cli redislock.RedisClient, key string, ttl time.Duration) (*RedisLock, error)

New creates a lock on key, waiting at most ttl to acquire it and holding it for ttl.

func (*RedisLock) Lock

func (r *RedisLock) Lock(ctx context.Context) (context.Context, error)

func (*RedisLock) Unlock

func (r *RedisLock) Unlock(ctx context.Context) error

Jump to

Keyboard shortcuts

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