12 lines
320 B
Go
12 lines
320 B
Go
package redis
|
|
|
|
import (
|
|
"github.com/go-redsync/redsync/v4"
|
|
"github.com/go-redsync/redsync/v4/redis/goredis"
|
|
)
|
|
|
|
// BuildLock 构建redis分布式锁。
|
|
func BuildLock(client *Client, key string, options ...redsync.Option) *redsync.Mutex {
|
|
return redsync.New(goredis.NewPool(client.client)).NewMutex(key, options...)
|
|
}
|