modulepackage
0.0.0-20241223182021-e02095f7303d
Repository: https://github.com/eininst/rlock.git
Documentation: pkg.go.dev
# README
Rlock
Implementation of redis lock
⚙️ Installation
go get -u github.com/eininst/rlock
⚡ Quickstart
func init(){
rlock.SetDefault(getRedis())
}
func main() {
ok, cancel := rlock.Acquire("lock_name_test", time.Second*10)
defer cancel()
if ok {
fmt.Println("my is safe")
}
}
👀 New a Instance
func main() {
lk := rlock.New(getRedis())
ok, cancel := lk.Acquire("lock_name_test", time.Second*10)
defer cancel()
if ok {
fmt.Println("my is safe")
}
}
See examples
License
MIT
# Packages
No description provided by the author
# Functions
6) 方便使用的全局函数.
5) 创建新的 Rlock 实例,并在首次调用时加载 Lua 脚本.
4) 全局方法 SetDefault,可设置单例锁实例.
No description provided by the author
# Type aliases
解锁函数类型.