Closed GoogleCodeExporter closed 8 years ago
Have you looked at WATCH in the transaction docs?
http://redis.io/topics/transactions
Original comment by jzaw...@gmail.com
on 19 Apr 2011 at 9:01
Thanks for the suggestion. However, that is somewhat different. I don't want to
use Redis transaction support. Version numbers could conceivably come from some
external system (so the new version number might actually be provided by the
conditional-set operation).
Also, the WATCH GET MULTI SET EXEC sequence ends up doing 5 operations for
something that could be done in 2 with version numbers as GETV CSETV.
Original comment by jwa...@gmail.com
on 20 Apr 2011 at 3:28
If you want something like versioning, why not implement it with INCR for
versions? You read the current version of a string, INCR its version key and
write to a new key. That way, you can always test the key holding the version
to see if the update you did was in fact the latest. A native solution for
versioning will likely never be added, so we can try and see if we can
implement something similar using the existing primitives. Can you check if the
INCR+SET+DEL loop would be applicable in your case?
Original comment by pcnoordh...@gmail.com
on 20 Apr 2011 at 8:04
Why would a native conditional store never be implemented?
Original comment by jwa...@gmail.com
on 21 Apr 2011 at 5:41
Implementing versioned string values is pretty straightforward, but for lists,
sets, etc, this is a big pain (unless you copy the structure prior to modifying
it, which can become very expensive for large lists, sets, etc.). Versioning
where you only keep the latest version, as Redis currently implicitly does, is
more feasible, and only requires to add an additional key storing the version
number and a WATCH on that version.
Original comment by pcnoordh...@gmail.com
on 21 Apr 2011 at 6:00
Original issue reported on code.google.com by
jwa...@gmail.com
on 19 Apr 2011 at 8:56