Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCouldNotLock = errors.New("lock could not be obtained") ErrCouldNotRelease = errors.New("lock could not be released") )
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock struct { Name string // contains filtered or unexported fields }
func NewLock ¶
func NewLock(name string, opts ...LockOption) *Lock
func (*Lock) AcquireAndKeepUp ¶
AcquireAndKeepUp will acquire a lock, and keep it up constantly until cancel is called, the returned context is a lock context and is detached from the parent context, meaning that any cancellation/timeout on the parent context does not affect this lock context.
type LockOption ¶
type LockOption func(l *Lock)
func SetClient ¶
func SetClient(client *redislock.Client) LockOption
func SetTTL ¶
func SetTTL(ttl time.Duration) LockOption
Click to show internal directories.
Click to hide internal directories.