Skip to content

Commit 65643db

Browse files
committed
feat: pool size and max active conns
1 parent d0ce6ed commit 65643db

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/kvtools/valkeyrie v1.0.0
7-
github.com/redis/go-redis/v9 v9.2.1
7+
github.com/redis/go-redis/v9 v9.7.0
88
github.com/stretchr/testify v1.10.0
99
)
1010

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ github.com/kvtools/valkeyrie v1.0.0 h1:LAITop2wPoYCMitR24GZZsW0b57hmI+ePD18VRTtO
1414
github.com/kvtools/valkeyrie v1.0.0/go.mod h1:bDi/OdhJCSbGPMsCgUQl881yuEweKCSItAtTBI+ZjpU=
1515
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1616
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
17-
github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg=
18-
github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
17+
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
18+
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
1919
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
2020
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2121
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

redis.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ func init() {
4949

5050
// Config the Redis configuration.
5151
type Config struct {
52-
TLS *tls.Config
53-
Username string
54-
Password string
55-
DB int
56-
Sentinel *Sentinel
52+
TLS *tls.Config
53+
Username string
54+
Password string
55+
DB int
56+
Sentinel *Sentinel
57+
PoolSize int
58+
MaxActiveConns int
5759
}
5860

5961
// Sentinel holds the Redis Sentinel configuration.
@@ -139,6 +141,8 @@ func newClient(endpoints []string, options *Config) (redis.UniversalClient, erro
139141
WriteTimeout: 30 * time.Second,
140142
ContextTimeoutEnabled: true,
141143
TLSConfig: options.TLS,
144+
PoolSize: options.PoolSize,
145+
MaxActiveConns: options.MaxActiveConns,
142146
}
143147

144148
if options.Sentinel.ClusterClient {
@@ -164,6 +168,8 @@ func newClient(endpoints []string, options *Config) (redis.UniversalClient, erro
164168
opt.Username = options.Username
165169
opt.Password = options.Password
166170
opt.DB = options.DB
171+
opt.PoolSize = options.PoolSize
172+
opt.MaxActiveConns = options.MaxActiveConns
167173
}
168174

169175
// TODO: use *redis.ClusterClient if we support multiple endpoints.

0 commit comments

Comments
 (0)