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

master
Summer-lights 11 months ago committed by GitHub
parent ebe0801d2f
commit 400386459c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save