From 77909564b94c517b0998e9308ba4e3baca5e75df Mon Sep 17 00:00:00 2001 From: shenzhuan Date: Thu, 24 Nov 2022 17:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/config.go b/config.go index cd5fea7..222541d 100644 --- a/config.go +++ b/config.go @@ -2,7 +2,6 @@ package common import ( "context" - "fmt" "github.com/go-redis/redis/v8" "log" "os" @@ -98,12 +97,6 @@ func GetRedisFromConsul(vip *viper.Viper) (red *redis.Client, err error) { PoolSize: vip.GetInt("poolSize"), MinIdleConns: vip.GetInt("minIdleConn"), }) - //集群 - clusterClients := redis.NewClusterClient( - &redis.ClusterOptions{ - Addrs: []string{"192.168.100.131:6380", "192.168.100.131:6381", "192.168.100.131:6382"}, - }) - fmt.Println(clusterClients) return red, nil } @@ -112,6 +105,11 @@ func SetUserToken(red *redis.Client, key string, val []byte, timeTTL time.Durati red.Set(context.Background(), key, val, timeTTL) } +// 订单Token +func SetOrderToken(red *redis.Client, key string, val string, timeTTL time.Duration) { + red.Set(context.Background(), key, val, timeTTL) +} + // 获取用户登录信息 func GetUserToken(red *redis.Client, key string) string { res, err := red.Get(context.Background(), key).Result()