From bbac418ae2fe8eea0fabdf69b093753017948e4a Mon Sep 17 00:00:00 2001 From: yuriy0803 Date: Wed, 31 Aug 2022 18:53:42 +0200 Subject: [PATCH] redis: support unix domain socket --- storage/redis.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/redis.go b/storage/redis.go index 8d761cf..b542871 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -156,12 +156,16 @@ type Worker struct { } func NewRedisClient(cfg *Config, prefix string, pplns int64, CoinName string) *RedisClient { - client := redis.NewClient(&redis.Options{ + options := redis.Options{ Addr: cfg.Endpoint, Password: cfg.Password, DB: cfg.Database, PoolSize: cfg.PoolSize, - }) + } + if cfg.Endpoint[0:1] == "/" { + options.Network = "unix" + } + client := redis.NewClient(&options) return &RedisClient{client: client, prefix: prefix, pplns: pplns, CoinName: CoinName} }