In tx.go (part of the go-redis library), the Unwatch()
function accepts an array of keys
as a parameter.
However, I’m wondering if it is necessary to pass in any keys
to Unwatch()
. The Redis documentation seems to imply that UNWATCH
does not need any additional arguments (see https://redis.io/docs/latest/commands/unwatch/).
Also, the Redis transactions docs say:
It is also possible to use the UNWATCH command (without arguments) in order to flush all the watched keys
So if I were to simply call Unwatch(ctx)
in Go, would this flush all the keys?
When testing locally, calling Unwatch(ctx)
without any keys seems to run fine and without errors, however there isn’t an easy way to verify the keys were actually flushed.
Shannon Feng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.