
Hi Salvatore,
I noticed that TTL of a key is removed when you use SET, but why? I thought that behavior is SAME when I use HSET, HDEL etc, but it seems that only SET will remove the TTL?
Another thought is about protocol compatibility. If it is desirable to change behavior of a command, you may face the problem of incompatibility and may feel reluctant to change, even such change is reasonable. In such case, is it possible to solve incompatibility problem by using CONFIG SET (redis.ini)?
Thanks,
Shannon
--
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

On Thu, Nov 3, 2011 at 3:47 PM, Joseph Jang <josep...@gmail.com> wrote:
> I don't think your example forces to choose a design choice.
Force, perhaps not. But I think it informs and pushes the decision in
a particular way.
> An situation in your example happens because SET and EXPIRE are
> separate operation, not because of semantics of expiration.
> SETEX atomically store string and set expiry time and solves your
> problem gently.
Sure, and that's under the assumption that people using this software
know all of the commands. Easily 10-20% of all posts in this mailing
list are people asking "how do I do ...?" Not uncommonly, the answer
is a "use command ... [with command ...]" AKA reading the
documentation.
> If you're on 'a heavilly-loaded system with much shorter TTLS',
> everything can become problematic with non-atomic operations.
> I can say we better not depend on TTL in the situation that requires
> <= 1000 milliseconds-precison without SETEX
I agree 100%, which is why I write against Redis to never use
expiration and TTLs. Either it's around forever, or I manually remove
it.
I agree that the scenario I posed was on the edge of being reasonable,
being that there is a command that so quickly and easily solves the
problem (under the alternate semantic "don't clear TTLs when setting a
key"). But the thing is, Redis can and will be used by people who
don't know all the commands, or for one reason or another choose not
to use that command. While I'm sure that Salvatore didn't think of the
race condition I mentioned while choosing the semantic, that there
exists a race condition in the semantic that he didn't choose (which
is being advocated for by at least one person), where no such race
condition exists in the current semantic, suggests that the current
semantic should be kept.
Or you can go with Salvatore's explanation that "SET X Y" is like
"DELETE X" followed by "SET X Y", which is simpler and easier :)
Regards,
- Josiah