7
7
8
8
type pipelineExecer func (context.Context , []Cmder ) error
9
9
10
- // Pipeliner is an mechanism to realise Redis Pipeline technique.
10
+ // Pipeliner is a mechanism to realise Redis Pipeline technique.
11
11
//
12
12
// Pipelining is a technique to extremely speed up processing by packing
13
13
// operations to batches, send them at once to Redis and read a replies in a
@@ -23,21 +23,24 @@ type pipelineExecer func(context.Context, []Cmder) error
23
23
type Pipeliner interface {
24
24
StatefulCmdable
25
25
26
- // Len is to obtain the number of commands in the pipeline that have not yet been executed.
26
+ // Len obtains the number of commands in the pipeline that have not yet been executed.
27
27
Len () int
28
28
29
29
// Do is an API for executing any command.
30
30
// If a certain Redis command is not yet supported, you can use Do to execute it.
31
31
Do (ctx context.Context , args ... interface {}) * Cmd
32
32
33
- // Process is to put the commands to be executed into the pipeline buffer.
33
+ // Process puts the commands to be executed into the pipeline buffer.
34
34
Process (ctx context.Context , cmd Cmder ) error
35
35
36
- // Discard is to discard all commands in the cache that have not yet been executed.
36
+ // Discard discards all commands in the pipeline buffer that have not yet been executed.
37
37
Discard ()
38
38
39
- // Exec is to send all the commands buffered in the pipeline to the redis- server.
39
+ // Exec sends all the commands buffered in the pipeline to the redis server.
40
40
Exec (ctx context.Context ) ([]Cmder , error )
41
+
42
+ // Cmds returns the list of queued commands.
43
+ Cmds () []Cmder
41
44
}
42
45
43
46
var _ Pipeliner = (* Pipeline )(nil )
@@ -119,3 +122,7 @@ func (c *Pipeline) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([
119
122
func (c * Pipeline ) TxPipeline () Pipeliner {
120
123
return c
121
124
}
125
+
126
+ func (c * Pipeline ) Cmds () []Cmder {
127
+ return c .cmds
128
+ }
0 commit comments