redisLock

package module
v0.0.0-...-0cca5ed Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: GPL-3.0 Imports: 2 Imported by: 1

README

There are a few Redis distributed lock written in Golang already. Somehow it is wrong to write one to waste our time tbh. But yeah, we are human which love to create problems.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

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

func (*Lock) GetName

func (l *Lock) GetName() string

func (*Lock) Release

func (l *Lock) Release()

Release if you are owing the lock by checking the token of the lock stored in Redis is the same or not

type LockFactory

type LockFactory struct {
	RedisClient *redis.Client `inject:""`
}

func New

func New(r *redis.Client) *LockFactory

func (*LockFactory) Lock

func (m *LockFactory) Lock(name string, options *LockOptions) *Lock

type LockOptions

type LockOptions struct {
	LockDuration time.Duration
	MaxWaitTime  time.Duration
}

Jump to

Keyboard shortcuts

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