Skip to content

Commit

Permalink
feat(redis): add redis client to opts
Browse files Browse the repository at this point in the history
  • Loading branch information
id committed May 19, 2020
1 parent d9b2608 commit f2ed092
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type SyncCacheOpts struct {
Address string
Password string
Db int
Redis Redis
}

type SyncCacheClient struct {
Expand All @@ -33,6 +34,11 @@ func NewSyncCacheClient(opts SyncCacheOpts) *SyncCacheClient {
},
}

if opts.Redis != nil {
c.redis = opts.Redis
return c
}

c.redis = redis.NewClient(&redis.Options{
Addr: opts.Address,
Password: opts.Password,
Expand Down

0 comments on commit f2ed092

Please sign in to comment.