mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Merge pull request #1677 from mattsta/expire-before-delete
Check key expiration before deleting
This commit is contained in:
commit
32c917964e
1
src/db.c
1
src/db.c
@ -280,6 +280,7 @@ void delCommand(redisClient *c) {
|
|||||||
int deleted = 0, j;
|
int deleted = 0, j;
|
||||||
|
|
||||||
for (j = 1; j < c->argc; j++) {
|
for (j = 1; j < c->argc; j++) {
|
||||||
|
expireIfNeeded(c->db,c->argv[j]);
|
||||||
if (dbDelete(c->db,c->argv[j])) {
|
if (dbDelete(c->db,c->argv[j])) {
|
||||||
signalModifiedKey(c->db,c->argv[j]);
|
signalModifiedKey(c->db,c->argv[j]);
|
||||||
notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,
|
notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,
|
||||||
|
@ -261,6 +261,14 @@ start_server {tags {"basic"}} {
|
|||||||
assert_equal 20 [r get x]
|
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} {
|
test {EXISTS} {
|
||||||
set res {}
|
set res {}
|
||||||
r set newkey test
|
r set newkey test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user