Skip to content

Commit a5aeb16

Browse files
committed
docs: update hook doc
Signed-off-by: monkey <golang@88.com>
1 parent 0ed4a44 commit a5aeb16

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

redis.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ type hooks struct {
8181

8282
// AddHook is to add a hook to the queue.
8383
// Hook is a function executed during network connection, command execution, and pipeline,
84-
// it is a first-in-last-out stack queue (FILO).
85-
// The first to be added to the queue is the execution function of the redis command (the last to be executed).
84+
// it is a first-in-first-out stack queue (FIFO).
8685
// You need to execute the next hook in each hook, unless you want to terminate the execution of the command.
8786
// For example, you added hook-1, hook-2:
8887
//
@@ -112,10 +111,10 @@ type hooks struct {
112111
//
113112
// The execution sequence is:
114113
//
115-
// hook-2 start -> hook-1 start -> exec redis cmd -> hook-1 end -> hook-2 end
114+
// hook-1 start -> hook-2 start -> exec redis cmd -> hook-2 end -> hook-1 end
116115
//
117116
// Please note: "next(ctx, cmd)" is very important, it will call the next hook,
118-
// if "next(ctx, cmd)" is not executed in hook-1, the redis command will not be executed.
117+
// if "next(ctx, cmd)" is not executed, the redis command will not be executed.
119118
func (hs *hooks) AddHook(hook Hook) {
120119
hs.slice = append(hs.slice, hook)
121120
hs.chain()

0 commit comments

Comments
 (0)