A Go package that provides mutex locking based on a key string.
go get github.com/jirenius/keylock
// Zero value of KeyLock is ready to use
kl := &KeyLock{}
// Lock key foo
kl.Lock("foo")
defer kl.Unlock("foo")
// Read lock key bar
kl.RLock("bar")
defer kl.RUnlock("bar")