locker

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// RedisAddress address for redis
	RedisAddress []string `yaml:"redis-address" json:"redisAddress,omitempty"`
}

Config for redis config locker

type Locker

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

Locker gloable locker

func CreateNew

func CreateNew(config *Config) (*Locker, error)

CreateNew new instance

func (*Locker) LockForKey added in v1.0.1

func (l *Locker) LockForKey(key string, expiry time.Duration) (*redsync.Mutex, error)

LockForKey lock for special key

func (*Locker) LockForKeyWithNoRetry

func (l *Locker) LockForKeyWithNoRetry(key string, expiry time.Duration) (*redsync.Mutex, error)

LockForKeyWithNoRetry lock for special key

func (*Locker) LockForKeyWithRetry

func (l *Locker) LockForKeyWithRetry(key string, expiry time.Duration, retry int) (*redsync.Mutex, error)

LockForKeyWithRetry lock for special key

func (*Locker) LockForKeyWithRetryDelay added in v1.0.1

func (l *Locker) LockForKeyWithRetryDelay(key string, expiry time.Duration, retry int, retryDelay time.Duration) (*redsync.Mutex, error)

LockForKeyWithRetryDelay lock for special key

func (*Locker) Unlock added in v1.2.1

func (l *Locker) Unlock(key string) (bool, error)

Unlock unlock a key

Jump to

Keyboard shortcuts

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