lock

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock interface {
	Init(...Option)
	Lock(key string, ttl ...time.Duration) error
	Check(key string) (bool, error)
	Unlock(key string) error
	TTL(key string) (int64, error)
}

type Option

type Option func(*Options)

func WithLockTime

func WithLockTime(lockTime time.Duration) Option

type Options

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

type RedisLock

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

func (*RedisLock) Check

func (rl *RedisLock) Check(key string) (bool, error)

func (*RedisLock) Init added in v1.0.28

func (rl *RedisLock) Init(opts ...Option)

func (*RedisLock) Lock

func (rl *RedisLock) Lock(key string, ttl ...time.Duration) error

func (*RedisLock) Provide

func (rl *RedisLock) Provide() interface{}

func (*RedisLock) TTL added in v1.0.28

func (rl *RedisLock) TTL(key string) (int64, error)

func (*RedisLock) Unlock

func (rl *RedisLock) Unlock(key string) error

Jump to

Keyboard shortcuts

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