Skip to content
Distributed locking on Go
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
gateway
.gitignore
.travis.yml
LICENSE
README.md
example_test.go
go.mod
go.sum
lock.go
locker.go
locker_test.go

README.md

go-locker

Build Status Coverage Status GoDoc Go Report Card

Distributed locking with pluggable storage for storing locks state.

Basic usage

// Create new Locker
lr, _ := locker.New(time.Millisecond * 100)
// Create and apply lock
if lk, err := lr.Lock("key"); err != nil { 
	if e, ok := err.(locker.TTLError); ok {
		// Use e.TTL() if need
	}	else {
		// Handle err
	}
} else {
	// Do smth
	lk.Unlock("key") // Release lock
}

Example usage

You can’t perform that action at this time.