redlock

package
v0.0.0-...-68f2149 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 6 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
}

A RedisLock is a redis lock.

func NewRedisLock

func NewRedisLock(store *redis.Client, key string) *RedisLock

NewRedisLock returns a RedisLock.

func (*RedisLock) Acquire

func (rl *RedisLock) Acquire() (bool, error)

Acquire acquires the lock.

func (*RedisLock) Compare

func (rl *RedisLock) Compare() (bool, error)

Compare if the lock is locked by myself

func (*RedisLock) GetValue

func (rl *RedisLock) GetValue() string

func (*RedisLock) Release

func (rl *RedisLock) Release() (bool, error)

Release releases the lock.

func (*RedisLock) SetExpire

func (rl *RedisLock) SetExpire(seconds int)

SetExpire sets the expiration.

Jump to

Keyboard shortcuts

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