fix(redis): redis ttl -1 and -2 (#3783)

This commit is contained in:
Summer-lights
2023-12-16 13:46:53 +08:00
committed by GitHub
parent ebe0801d2f
commit 400386459c

View File

@@ -1993,7 +1993,13 @@ func (s *Redis) TtlCtx(ctx context.Context, key string) (val int, err error) {
return err
}
val = int(duration / time.Second)
if duration >= 0 {
val = int(duration / time.Second)
} else {
// -2 means key does not exist
// -1 means key exists but has no expire
val = int(duration)
}
return nil
}, acceptable)