mirror of
https://github.com/fluencelabs/redis
synced 2025-05-12 02:37:11 +00:00
PERSIST: a fix and some basic test
This commit is contained in:
parent
a539d29ac5
commit
1fb4e8def7
6
src/db.c
6
src/db.c
@ -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}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user