Skip to content

Commit f2ed092

Browse files
author
id
committed
feat(redis): add redis client to opts
1 parent d9b2608 commit f2ed092

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cache.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type SyncCacheOpts struct {
1313
Address string
1414
Password string
1515
Db int
16+
Redis Redis
1617
}
1718

1819
type SyncCacheClient struct {
@@ -33,6 +34,11 @@ func NewSyncCacheClient(opts SyncCacheOpts) *SyncCacheClient {
3334
},
3435
}
3536

37+
if opts.Redis != nil {
38+
c.redis = opts.Redis
39+
return c
40+
}
41+
3642
c.redis = redis.NewClient(&redis.Options{
3743
Addr: opts.Address,
3844
Password: opts.Password,

0 commit comments

Comments
 (0)