redis_lock

package module
v0.0.0-...-92c08c7 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: BSD-2-Clause Imports: 5 Imported by: 0

README

redis_lock

redis distribute lock

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotLock       = errors.New("no lock")
	ErrWrongKeyOrTag = errors.New("wrong key or tag")
)

Functions

This section is empty.

Types

type Locker

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

func New

func New(key, tag string, expire time.Duration, client *redis.Client) *Locker

func (*Locker) AutoExpire

func (l *Locker) AutoExpire(expire, interval time.Duration) (err error)

func (*Locker) Expire

func (l *Locker) Expire(expire time.Duration) (bool, error)

func (*Locker) Lock

func (l *Locker) Lock() error

func (*Locker) TTl

func (l *Locker) TTl() (time.Duration, error)

func (*Locker) Unlock

func (l *Locker) Unlock() (err error)

Jump to

Keyboard shortcuts

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