Help us shape the future of Go! Take the 2026 Go Developer Survey

dlock

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DLock

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

DLock 分布式锁,基于注册中心实现的分布式锁

func NewLock

func NewLock(name string, addr string, l logger.ILogging) (lk *DLock, err error)

NewLock 构建分布式锁

func NewLockByRegistry

func NewLockByRegistry(name string, r registry.IRegistry) (lk *DLock)

NewLockByRegistry 根据当前注册中心创建分布式锁

func (*DLock) Lock

func (d *DLock) Lock(timeout ...time.Duration) (err error)

Lock 以独占方式获取分布式锁

func (*DLock) TryLock

func (d *DLock) TryLock() (err error)

TryLock 偿试获取分布式锁

func (*DLock) Unlock

func (d *DLock) Unlock()

Unlock 释放分布式锁

Jump to

Keyboard shortcuts

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