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
c6bf4a00
Commit
c6bf4a00
authored
Mar 28, 2012
by
Premysl Hruby
Committed by
antirez
Apr 05, 2012
Browse files
for (p)expireat use absolute time, without double recomputation
parent
d48d1309
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
c6bf4a00
...
...
@@ -527,7 +527,7 @@ void expireGenericCommand(redisClient *c, long long offset, int unit) {
return
;
if
(
unit
==
UNIT_SECONDS
)
milliseconds
*=
1000
;
milliseconds
-
=
offset
;
milliseconds
+
=
offset
;
de
=
dictFind
(
c
->
db
->
dict
,
key
->
ptr
);
if
(
de
==
NULL
)
{
...
...
@@ -554,8 +554,7 @@ void expireGenericCommand(redisClient *c, long long offset, int unit) {
addReply
(
c
,
shared
.
cone
);
return
;
}
else
{
long
long
when
=
mstime
()
+
milliseconds
;
setExpire
(
c
->
db
,
key
,
when
);
setExpire
(
c
->
db
,
key
,
milliseconds
);
addReply
(
c
,
shared
.
cone
);
signalModifiedKey
(
c
->
db
,
key
);
server
.
dirty
++
;
...
...
@@ -564,19 +563,19 @@ void expireGenericCommand(redisClient *c, long long offset, int unit) {
}
void
expireCommand
(
redisClient
*
c
)
{
expireGenericCommand
(
c
,
0
,
UNIT_SECONDS
);
expireGenericCommand
(
c
,
mstime
()
,
UNIT_SECONDS
);
}
void
expireatCommand
(
redisClient
*
c
)
{
expireGenericCommand
(
c
,
mstime
()
,
UNIT_SECONDS
);
expireGenericCommand
(
c
,
0
,
UNIT_SECONDS
);
}
void
pexpireCommand
(
redisClient
*
c
)
{
expireGenericCommand
(
c
,
0
,
UNIT_MILLISECONDS
);
expireGenericCommand
(
c
,
mstime
()
,
UNIT_MILLISECONDS
);
}
void
pexpireatCommand
(
redisClient
*
c
)
{
expireGenericCommand
(
c
,
mstime
()
,
UNIT_MILLISECONDS
);
expireGenericCommand
(
c
,
0
,
UNIT_MILLISECONDS
);
}
void
ttlGenericCommand
(
redisClient
*
c
,
int
output_ms
)
{
...
...
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