redislock

package module
v0.0.0-...-19604f9 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 6 Imported by: 0

README

redislock

Distribute Lock Based On Redis

Documentation

Index

Constants

View Source
const (
	DefaultRetry        = 5
	DefaultInterval     = 100 * time.Millisecond
	DefaultExpire       = 5 * time.Second
	DefaultExpireUnsame = 600 * time.Second
)

Variables

View Source
var ErrFailed = errors.New("failed to acquire lock")

Functions

This section is empty.

Types

type RedisLock

type RedisLock struct {
	Expiry        time.Duration
	Retry         int
	RetryInterval time.Duration
	// contains filtered or unexported fields
}

func NewRedisLock

func NewRedisLock(lk string, sameLock bool) *RedisLock

func NewRedisLockWithParam

func NewRedisLockWithParam(lk string, expire time.Duration, retry int, interval time.Duration, sameLock bool) *RedisLock

func (*RedisLock) Lock

func (rl *RedisLock) Lock(rds *redis.Client) error

func (*RedisLock) UnLock

func (rl *RedisLock) UnLock(rds *redis.Client) error

Jump to

Keyboard shortcuts

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