|
|
@ -1,7 +1,6 @@
|
|
|
|
package redis
|
|
|
|
package redis
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"github.com/tal-tech/go-zero/core/stringx"
|
|
|
|
|
|
|
|
"math/rand"
|
|
|
|
"math/rand"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"sync/atomic"
|
|
|
|
"sync/atomic"
|
|
|
@ -9,10 +8,10 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
red "github.com/go-redis/redis"
|
|
|
|
red "github.com/go-redis/redis"
|
|
|
|
"github.com/tal-tech/go-zero/core/logx"
|
|
|
|
"github.com/tal-tech/go-zero/core/logx"
|
|
|
|
|
|
|
|
"github.com/tal-tech/go-zero/core/stringx"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
|
|
|
|
lockCommand = `if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
|
|
lockCommand = `if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
|
|
redis.call("SET", KEYS[1], ARGV[1], "PX", ARGV[2])
|
|
|
|
redis.call("SET", KEYS[1], ARGV[1], "PX", ARGV[2])
|
|
|
|
return "OK"
|
|
|
|
return "OK"
|
|
|
|