lock

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSessionTTL = 60

Variables

This section is empty.

Functions

func RegisterLocker

func RegisterLocker(name string, f NewFunc)

Types

type ILocker

type ILocker interface {
	Lock(key string, opts ...SessionOption) error
	Unlock()
	ErrC() <-chan error
}

type NewFunc

type NewFunc func(configId string) ILocker

func LoadLocker

func LoadLocker(name string) (NewFunc, bool)

type SessionOption

type SessionOption func(*SessionOptions)

SessionOption configures Session.

func WithDisableKeepAlive

func WithDisableKeepAlive() SessionOption

func WithErrorNotify

func WithErrorNotify() SessionOption

func WithTTL

func WithTTL(ttl int64) SessionOption

If TTL is <= 0, the default 60 seconds TTL will be used.

func WithWaitTime

func WithWaitTime(waitTime time.Duration) SessionOption

type SessionOptions

type SessionOptions struct {
	TTL              int64
	DisableKeepAlive bool
	WaitTime         time.Duration
	ErrorNotify      bool
}

Jump to

Keyboard shortcuts

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