summaryrefslogtreecommitdiff
path: root/src/expire.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-06-13 10:35:51 +0200
committerantirez <antirez@gmail.com>2017-06-13 10:35:51 +0200
commit5877c02c5102d7f01e3a41937ffdea098a63befe (patch)
tree3d4864502ec0b41ceae473829fcf8f3d1db69b50 /src/expire.c
parente91b81c612cc8b0cbb4e7f9bc895e5f23d497027 (diff)
downloadredis-5877c02c5102d7f01e3a41937ffdea098a63befe.tar.gz
Fix PERSIST expired key resuscitation issue #4048.
Diffstat (limited to 'src/expire.c')
-rw-r--r--src/expire.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/expire.c b/src/expire.c
index 22b1f1da9..d3a0e3f69 100644
--- a/src/expire.c
+++ b/src/expire.c
@@ -477,18 +477,15 @@ void pttlCommand(client *c) {
/* PERSIST key */
void persistCommand(client *c) {
- dictEntry *de;
-
- de = dictFind(c->db->dict,c->argv[1]->ptr);
- if (de == NULL) {
- addReply(c,shared.czero);
- } else {
+ if (lookupKeyWrite(c->db,c->argv[1])) {
if (removeExpire(c->db,c->argv[1])) {
addReply(c,shared.cone);
server.dirty++;
} else {
addReply(c,shared.czero);
}
+ } else {
+ addReply(c,shared.czero);
}
}