From 1203e27c7ef7c29b9df511a4ea6a23ec135ad60e Mon Sep 17 00:00:00 2001 From: charlie <3140647@qq.com> Date: Thu, 12 Oct 2023 15:01:16 +0800 Subject: [PATCH] add DB --- redis/redis.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redis/redis.go b/redis/redis.go index 1672d95..0093b3a 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -28,6 +28,10 @@ type ReidsOption struct { Prefix string Separator string + // Database to be selected after connecting to the server. + // Only single-node and failover clients. + DB int + MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration @@ -56,6 +60,8 @@ func New(opt *ReidsOption) Client { Addrs: opt.Addrs, Password: opt.Password, + DB: opt.DB, + MaxRetries: opt.MaxRetries, MinRetryBackoff: opt.MinRetryBackoff, MaxRetryBackoff: opt.MaxRetryBackoff,