This has been discussed before.
Prior answers:
1. Use a lock (written in the standard watch/multi/exec (this can be
tricky) or Lua)
2. Use Lua to write your compare-and-swap
Either of these lets you express *exactly* what you want without
having to guess.
If you have a limitation that you need to use a version of Redis
before scripting, or need it *now* and can't run one of the Redis
release candidates, then your option is basically to use a lock. Read
my article from January about building a correct lock:
http://dr-josiah.blogspot.com/2012/01/creating-lock-with-redis.html
... because incorrect locks can destroy data.
Regards,
- Josiah
> --
> 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.