Closed armolee closed 2 years ago
EX value is in seconds so I suspect you want the following which also includes some style cleanups
func Set(key, value string, timeout int) error {
c := pool.Get()
defer c.Close()
if _, err := c.Do("set", key, value, "EX", timeout); err != nil {
return fmt.Errorf("set %s=%s failed, err=%w", key, value, err)
}
return nil
}
Ask questions at https://stackoverflow.com/questions/ask?tags=go+redis
in the code:
2022/05/19 22:11:54.089 [W] [send.go:84] set robot token to redis failed, err = set xxx-xxx-robot-token=at_512fd330-f287-48ae-90c9-6f2545849110 failed, err=ERR value is not an integer or out of range
in redis cli: