Document Script.Run. Fixes #536

This commit is contained in:
Vladimir Mihailenco 2017-04-08 09:35:56 +03:00
parent dd76391eb9
commit 2e4944712d
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ func (s *Script) EvalSha(c scripter, keys []string, args ...interface{}) *Cmd {
return c.EvalSha(s.hash, keys, args...)
}
// Run optimistically uses EVALSHA to run the script. If script does not exist
// it is retried using EVAL.
func (s *Script) Run(c scripter, keys []string, args ...interface{}) *Cmd {
r := s.EvalSha(c, keys, args...)
if err := r.Err(); err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") {