Skip to content

mjaow/keylock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keylock

Golang keylock implement, used when user want to lock action by key,uuid or sth

Easy and Fast

Correctness

=== RUN   TestKeyMutex
--- PASS: TestKeyMutex (0.48s)
=== RUN   TestNewKeyLockWithLock
--- PASS: TestNewKeyLockWithLock (2.00s)
=== RUN   TestNewKeyLockWithoutLock
--- PASS: TestNewKeyLockWithoutLock (1.00s)
PASS
ok      keylock   4.501s

Performance

goos: darwin
goarch: amd64
pkg: keylock
BenchmarkKeyLock-12      2000000               904 ns/op

Compare To

goos: darwin
goarch: amd64
pkg: keylock

# keylock
BenchmarkKeyLock-12              2000000               797 ns/op              83 B/op          0 allocs/op

# github.com/alibaba/pouch/pkg/kmutex
BenchmarkPCKeyLock-12            1000000              1861 ns/op             322 B/op          2 allocs/op

# github.com/im7mortal/kmutex
BenchmarkKmutex-12                 10000            737253 ns/op             216 B/op          2 allocs/op

PASS
ok      keylock   12.992s

About

golang lock by key, or keylock

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages