提交 1fb4e8de 编写于 作者: A antirez

PERSIST: a fix and some basic test

上级 a539d29a
......@@ -532,9 +532,11 @@ void persistCommand(redisClient *c) {
if (de == NULL) {
addReply(c,shared.czero);
} else {
if (removeExpire(c->db,c->argv[1]))
if (removeExpire(c->db,c->argv[1])) {
addReply(c,shared.cone);
else
server.dirty++;
} else {
addReply(c,shared.czero);
}
}
}
......@@ -60,4 +60,15 @@ start_server {tags {"expire"}} {
catch {r setex z -10 foo} e
set _ $e
} {*invalid expire*}
test {PERSIST can undo an EXPIRE} {
r set x foo
r expire x 50
list [r ttl x] [r persist x] [r ttl x] [r get x]
} {50 1 -1 foo}
test {PERSIST returns 0 against non existing or non volatile keys} {
r set x foo
list [r persist foo] [r persist nokeyatall]
} {0 0}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册