Ciao Salvatore,
On Wed, Aug 7, 2013 at 11:55 AM, Salvatore Sanfilippo <
ant...@gmail.com> wrote:
> I just noticed that WATCH is not affected by the server removing a key
> because of an expire set. This sounds wrong, I imagine I may want to
> modify a given key only if the key is still there in case there is an
> expire set, like in:
I do agree, by the way I think this should happen only if you were
watching a key before it gets expired.
> r = Redis.new
> r.del(:foo)
> r.lpush(:foo,"A")
> r.expire(:foo,2)
> sleep(3)
> r.watch(:foo)
> r.multi {
> r.lpush(:foo,"B")
> }
so to rephrase the code above to make it fails, I'd do something like:
r = Redis.new
r.del(:foo)
r.lpush(:foo, "A")
r.expire(:foo, 2)
r.watch(:foo)
sleep(3)
r.multi { r.lpush(:foo, "B") }
Cheers,
matteo.