Skip to content

Commit

Permalink
chore: update redis universal creation
Browse files Browse the repository at this point in the history
  • Loading branch information
lehainam-dev committed Apr 11, 2024
1 parent ba50bbd commit 0997df1
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions pkg/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ import (

// Config ...
type Config struct {
MasterName string
Addrs []string
DB int
Username string
Password string
SentinelUsername string
SentinelPassword string
KeyPrefix string
ReadTimeout time.Duration
WriteTimeout time.Duration
MasterName string
Addrs []string
DB int
Username string
Password string
KeyPrefix string
ReadTimeout time.Duration
WriteTimeout time.Duration
}

// Client ...
Expand All @@ -33,15 +31,12 @@ type Client struct {
// New ...
func New(cfg Config) (*Client, error) {
client := redis.NewUniversalClient(&redis.UniversalOptions{
MasterName: cfg.MasterName,
Addrs: cfg.Addrs,
DB: cfg.DB,
Username: cfg.Username,
Password: cfg.Password,
SentinelUsername: cfg.SentinelUsername,
SentinelPassword: cfg.SentinelPassword,
ReadTimeout: cfg.ReadTimeout,
WriteTimeout: cfg.WriteTimeout,
MasterName: cfg.MasterName,
Addrs: cfg.Addrs,
DB: cfg.DB,
Password: cfg.Password,
ReadTimeout: cfg.ReadTimeout,
WriteTimeout: cfg.WriteTimeout,
})

if _, err := client.Ping(context.Background()).Result(); err != nil {
Expand Down

0 comments on commit 0997df1

Please sign in to comment.