MCPcopy
hub / github.com/redis/go-redis / AddHook

Method AddHook

redis.go:138–141  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
138func (hs *hooksMixin) AddHook(hook Hook) {
139 hs.slice = append(hs.slice, hook)
140 hs.chain()
141}
142
143func (hs *hooksMixin) chain() {
144 hs.initial.setDefaults()

Callers

nothing calls this directly

Calls 1

chainMethod · 0.95

Tested by

no test coverage detected