AddHook is to add a hook to the queue. Hook is a function executed during network connection, command execution, and pipeline, it is a first-in-first-out stack queue (FIFO). You need to execute the next hook in each hook, unless you want to terminate the execution of the command. For example, you ad
(hook Hook)
| 136 | // Please note: "next(ctx, cmd)" is very important, it will call the next hook, |
| 137 | // if "next(ctx, cmd)" is not executed, the redis command will not be executed. |
| 138 | func (hs *hooksMixin) AddHook(hook Hook) { |
| 139 | hs.slice = append(hs.slice, hook) |
| 140 | hs.chain() |
| 141 | } |
| 142 | |
| 143 | func (hs *hooksMixin) chain() { |
| 144 | hs.initial.setDefaults() |