Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
32c91796
Commit
32c91796
authored
Apr 23, 2014
by
Salvatore Sanfilippo
Browse files
Merge pull request #1677 from mattsta/expire-before-delete
Check key expiration before deleting
parents
12e435d2
88530804
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
32c91796
...
@@ -280,6 +280,7 @@ void delCommand(redisClient *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
,
...
...
tests/unit/basic.tcl
View file @
32c91796
...
@@ -261,6 +261,14 @@ start_server {tags {"basic"}} {
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment