lock

package
v0.0.0-...-01681b2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 5 Imported by: 0

README

利用 Mysql InnoDB Transaction, 实现一个分布式锁

目前的缺点是,没有超时机制,不过 mysql 的 transaction 应该有几十秒.

Documentation

Index

Constants

View Source
const LockTableName = "distributedlock"

Variables

This section is empty.

Functions

This section is empty.

Types

type DistributedLock

type DistributedLock struct {
	Id      int
	Name    string
	Status  int
	Created string
	Updated string
	// contains filtered or unexported fields
}

func New

func New(mysqlDSN string, lockName string) *DistributedLock

func (*DistributedLock) Lock

func (l *DistributedLock) Lock()

func (*DistributedLock) Unlock

func (l *DistributedLock) Unlock()

Jump to

Keyboard shortcuts

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