|
@@ -1,25 +0,0 @@
|
|
|
-package util
|
|
|
-
|
|
|
-import (
|
|
|
- "context"
|
|
|
- "github.com/go-redis/redis"
|
|
|
- "time"
|
|
|
-)
|
|
|
-
|
|
|
-func NewClusterClient(adds []string) *redis.ClusterClient {
|
|
|
- client := redis.NewClusterClient(&redis.ClusterOptions{
|
|
|
- Addrs: adds,
|
|
|
- MaxRedirects: 5,
|
|
|
- PoolSize: 10,
|
|
|
- MaxRetries: 3,
|
|
|
- })
|
|
|
- return client
|
|
|
-}
|
|
|
-
|
|
|
-func Get(rdb *redis.ClusterClient, ctx context.Context, key string) *redis.StringCmd {
|
|
|
- return rdb.Get(ctx, key)
|
|
|
-}
|
|
|
-
|
|
|
-func RedisClusterPut(rdb *redis.ClusterClient, ctx context.Context, key string, value interface{}, d time.Duration) *redis.StatusCmd {
|
|
|
- return rdb.Set(ctx, key, value, d)
|
|
|
-}
|