locker

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 4 Imported by: 0

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
}

Lock struct to abstract bsm/redis-lock

func (*Lock) Run

func (l *Lock) Run(key string, timeout time.Duration, handler func())

Run runs a callback handler with a Redis lock.

type Locker

type Locker interface {
	Run(key string, timeout time.Duration, handler func())
}

Locker interface to abstract bsm/redis-lock

func New

func New(opts ...Option) Locker

New creates instance of Locker

type Option

type Option func(*Options)

Option closure

func Logger

func Logger(l logger.Logger) Option

Logger closure to set field in Options

func Redis

func Redis(r *redis.Client) Option

Redis closure to set field in Options

type Options

type Options struct {
	Redis  *redis.Client
	Logger logger.Logger
}

Options for creating Locker instance

Jump to

Keyboard shortcuts

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