Skip to content

Commit

Permalink
[#2]: bug(ttl): TTL should be in the RFC3339 time format
Browse files Browse the repository at this point in the history
  • Loading branch information
rustatian authored Feb 22, 2022
2 parents 7645cc2 + 0d6bb63 commit cf26caa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,13 @@ func (d *Driver) TTL(keys ...string) (map[string]string, error) {
return nil, err
}

m[key] = duration.String()
// The command returns -2 if the key does not exist.
// The command returns -1 if the key exists but has no associated expire.
if duration == -1 || duration == -2 {
continue
}

m[key] = time.Now().Add(duration).Format(time.RFC3339)
}
return m, nil
}
Expand Down

0 comments on commit cf26caa

Please sign in to comment.