groupdb
This commit is contained in:
Vendored
+6
-5
@@ -42,9 +42,10 @@ const (
|
||||
exTypeKeyLocker = "EX_LOCK:"
|
||||
)
|
||||
|
||||
func InitRedis(ctx context.Context) go_redis.UniversalClient {
|
||||
func InitRedis() go_redis.UniversalClient {
|
||||
var rdb go_redis.UniversalClient
|
||||
var err error
|
||||
ctx := context.Background()
|
||||
if config.Config.Redis.EnableCluster {
|
||||
rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{
|
||||
Addrs: config.Config.Redis.DBAddress,
|
||||
@@ -73,14 +74,14 @@ func InitRedis(ctx context.Context) go_redis.UniversalClient {
|
||||
return rdb
|
||||
}
|
||||
|
||||
func NewRedisClient(rdb go_redis.UniversalClient) *RedisClient {
|
||||
return &RedisClient{rdb: rdb}
|
||||
}
|
||||
|
||||
type RedisClient struct {
|
||||
rdb go_redis.UniversalClient
|
||||
}
|
||||
|
||||
func NewRedisClient(rdb go_redis.UniversalClient) *RedisClient {
|
||||
return &RedisClient{rdb: rdb}
|
||||
}
|
||||
|
||||
func (r *RedisClient) JudgeAccountEXISTS(account string) (bool, error) {
|
||||
key := accountTempCode + account
|
||||
n, err := r.rdb.Exists(context.Background(), key).Result()
|
||||
|
||||
Reference in New Issue
Block a user