Merge pull request #1677 from mattsta/expire-before-delete

Check key expiration before deleting
This commit is contained in:
Salvatore Sanfilippo 2014-04-23 16:13:49 +02:00
commit 32c917964e
2 changed files with 9 additions and 0 deletions

View File

@ -280,6 +280,7 @@ void delCommand(redisClient *c) {
int deleted = 0, j;
for (j = 1; j < c->argc; j++) {
expireIfNeeded(c->db,c->argv[j]);
if (dbDelete(c->db,c->argv[j])) {
signalModifiedKey(c->db,c->argv[j]);
notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,

View File

@ -261,6 +261,14 @@ start_server {tags {"basic"}} {
assert_equal 20 [r get x]
}
test "DEL against expired key" {
r debug set-active-expire 0
r setex keyExpire 1 valExpire
after 1100
assert_equal 0 [r del keyExpire]
r debug set-active-expire 1
}
test {EXISTS} {
set res {}
r set newkey test