Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e8a1a169
Commit
e8a1a169
authored
Mar 28, 2013
by
antirez
Browse files
EXPIRE should not resurrect keys. Issue #1026.
parent
dc0f1377
Changes
1
Show whitespace changes
Inline
Side-by-side
src/db.c
View file @
e8a1a169
...
@@ -540,7 +540,6 @@ int expireIfNeeded(redisDb *db, robj *key) {
...
@@ -540,7 +540,6 @@ int expireIfNeeded(redisDb *db, robj *key) {
* unit is either UNIT_SECONDS or UNIT_MILLISECONDS, and is only used for
* unit is either UNIT_SECONDS or UNIT_MILLISECONDS, and is only used for
* the argv[2] parameter. The basetime is always specified in milliseconds. */
* the argv[2] parameter. The basetime is always specified in milliseconds. */
void
expireGenericCommand
(
redisClient
*
c
,
long
long
basetime
,
int
unit
)
{
void
expireGenericCommand
(
redisClient
*
c
,
long
long
basetime
,
int
unit
)
{
dictEntry
*
de
;
robj
*
key
=
c
->
argv
[
1
],
*
param
=
c
->
argv
[
2
];
robj
*
key
=
c
->
argv
[
1
],
*
param
=
c
->
argv
[
2
];
long
long
when
;
/* unix time in milliseconds when the key will expire. */
long
long
when
;
/* unix time in milliseconds when the key will expire. */
...
@@ -550,11 +549,12 @@ void expireGenericCommand(redisClient *c, long long basetime, int unit) {
...
@@ -550,11 +549,12 @@ void expireGenericCommand(redisClient *c, long long basetime, int unit) {
if
(
unit
==
UNIT_SECONDS
)
when
*=
1000
;
if
(
unit
==
UNIT_SECONDS
)
when
*=
1000
;
when
+=
basetime
;
when
+=
basetime
;
de
=
dictFind
(
c
->
db
->
dict
,
key
->
ptr
);
/* No key, return zero. */
if
(
de
==
NULL
)
{
if
(
lookupKeyRead
(
c
->
db
,
key
)
==
NULL
)
{
addReply
(
c
,
shared
.
czero
);
addReply
(
c
,
shared
.
czero
);
return
;
return
;
}
}
/* EXPIRE with negative TTL, or EXPIREAT with a timestamp into the past
/* EXPIRE with negative TTL, or EXPIREAT with a timestamp into the past
* should never be executed as a DEL when load the AOF or in the context
* should never be executed as a DEL when load the AOF or in the context
* of a slave instance.
* of a slave instance.
...
...
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