Commit b7a8daef authored by antirez's avatar antirez
Browse files

WATCH will now consider touched keys target of EXPIRE command after the WATCH...

WATCH will now consider touched keys target of EXPIRE command after the WATCH is performed, but not before
parent 3688d7f3
......@@ -472,11 +472,13 @@ void expireGenericCommand(redisClient *c, robj *key, robj *param, long offset) {
if (seconds <= 0) {
if (dbDelete(c->db,key)) server.dirty++;
addReply(c, shared.cone);
touchWatchedKey(c->db,key);
return;
} else {
time_t when = time(NULL)+seconds;
if (setExpire(c->db,key,when)) {
addReply(c,shared.cone);
touchWatchedKey(c->db,key);
server.dirty++;
} else {
addReply(c,shared.czero);
......
......@@ -111,4 +111,25 @@ start_server {tags {"cas"}} {
r ping
r exec
} {PONG}
test {WATCH will consider touched keys target of EXPIRE} {
r del x
r set x foo
r watch x
r expire x 10
r multi
r ping
r exec
} {}
test {WATCH will not consider touched expired keys} {
r del x
r set x foo
r expire x 2
r watch x
after 3000
r multi
r ping
r exec
} {PONG}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment