Hi list,
currently the TTL command returns -1 on non existing key, and also in
the case no expire time is set on the key at all.
Starting with Redis 2.8 I would like to change the behavior into the following:
Key without TTL -> -1
Non existing key TTL -> -2
I don't think this is going to break a lot of code at all, but I
wonder what you think. This API makes sense as to have the old
behavior you need just:
if ttl(key) < 0, instead of explicitly checking for -1
Instead in order to distinguish the two other different cases, just
check for the proper value, that your client library could declare as
constants for simplicity.
About the sequence -1 and -2, the rationale is that -1 no TTL and -2
no key at all is in accordance with the fact that -2 feels "more
negative" than -1, so it is easy to remember.
Cheers,
Salvatore
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
— David Gelernter