Skip to content

ChannelMeter/redislock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

redislock

Pessimistic locking for Go using Redis.

Installation

go get -u github.com/atomic-labs/redislock

Documentation

http://godoc.org/github.com/atomic-labs/redislock

Example

lock, ok, err := redislock.TryLock(conn, "user:123")
if err != nil {
	log.Fatal("Error while attempting lock")
}
if !ok {
	// User is in use - return to avoid duplicate work, race conditions, etc.
	return
}
defer lock.Unlock()

// Do something with the user.

About

Pessimistic locking for Go using Redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages