RedLock

package module
v0.0.0-...-b021c09 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

README

RedLock

golang实现的Redis distribute Lock,Based on Redlock-rb by Salvatore Sanfilippo For useage please reference to test instance。

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClockDriftFactor = 0.01 //
View Source
var Gval string
View Source
var QuoRum int
View Source
var RedisList []*redis.Pool
View Source
var Resource string //

Functions

func ContinueLock

func ContinueLock(conn *redis.Pool, resource string, ttl int32) bool

func ContinueLockInstance

func ContinueLockInstance(conn *redis.Pool, resouce, val string, ttl int32) bool

func GetUniqueLockId

func GetUniqueLockId() string

func Lock

func Lock(resource string) bool

func LockInstance

func LockInstance(conn *redis.Pool, resouce, val string, ttl int32) bool

func UnLock

func UnLock(resource, val string) bool

func UnLockInstance

func UnLockInstance(conn *redis.Pool, resouce, val string) bool

Types

type RedCfg

type RedCfg struct {
	RedisServerList  []RedisServer
	TTl              int32
	RetryCount       int32
	RetryDelay       int
	ClockDriftFactor float32
}
var RedCfgParm RedCfg

type RedisServer

type RedisServer struct {
	RedisHost string
	RedisPort int32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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