Skip to content

Commit 8336c44

Browse files
authored
chore(client): fix UniversalOptions miss ReadBufferSize and WriteBufferSize options (#3485)
Signed-off-by: Xiaolong Chen <[email protected]>
1 parent d2ad801 commit 8336c44

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

universal.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ type UniversalOptions struct {
6161
WriteTimeout time.Duration
6262
ContextTimeoutEnabled bool
6363

64+
// ReadBufferSize is the size of the bufio.Reader buffer for each connection.
65+
// Larger buffers can improve performance for commands that return large responses.
66+
// Smaller buffers can improve memory usage for larger pools.
67+
//
68+
// default: 256KiB (262144 bytes)
69+
ReadBufferSize int
70+
71+
// WriteBufferSize is the size of the bufio.Writer buffer for each connection.
72+
// Larger buffers can improve performance for large pipelines and commands with many arguments.
73+
// Smaller buffers can improve memory usage for larger pools.
74+
//
75+
// default: 256KiB (262144 bytes)
76+
WriteBufferSize int
77+
6478
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
6579
PoolFIFO bool
6680

@@ -143,6 +157,9 @@ func (o *UniversalOptions) Cluster() *ClusterOptions {
143157
WriteTimeout: o.WriteTimeout,
144158
ContextTimeoutEnabled: o.ContextTimeoutEnabled,
145159

160+
ReadBufferSize: o.ReadBufferSize,
161+
WriteBufferSize: o.WriteBufferSize,
162+
146163
PoolFIFO: o.PoolFIFO,
147164

148165
PoolSize: o.PoolSize,
@@ -200,6 +217,9 @@ func (o *UniversalOptions) Failover() *FailoverOptions {
200217
WriteTimeout: o.WriteTimeout,
201218
ContextTimeoutEnabled: o.ContextTimeoutEnabled,
202219

220+
ReadBufferSize: o.ReadBufferSize,
221+
WriteBufferSize: o.WriteBufferSize,
222+
203223
PoolFIFO: o.PoolFIFO,
204224
PoolSize: o.PoolSize,
205225
PoolTimeout: o.PoolTimeout,
@@ -250,6 +270,9 @@ func (o *UniversalOptions) Simple() *Options {
250270
WriteTimeout: o.WriteTimeout,
251271
ContextTimeoutEnabled: o.ContextTimeoutEnabled,
252272

273+
ReadBufferSize: o.ReadBufferSize,
274+
WriteBufferSize: o.WriteBufferSize,
275+
253276
PoolFIFO: o.PoolFIFO,
254277
PoolSize: o.PoolSize,
255278
PoolTimeout: o.PoolTimeout,

0 commit comments

Comments
 (0)