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
3761582f
Commit
3761582f
authored
Oct 24, 2018
by
antirez
Browse files
Simplify part of the #5470 patch.
parent
edc47a3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
3761582f
...
...
@@ -1161,18 +1161,17 @@ int keyIsExpired(redisDb *db, robj *key) {
* The return value of the function is 0 if the key is still valid,
* otherwise the function returns 1 if the key is expired. */
int
expireIfNeeded
(
redisDb
*
db
,
robj
*
key
)
{
if
(
!
keyIsExpired
(
db
,
key
))
{
return
0
;
}
else
if
(
server
.
masterhost
!=
NULL
)
{
/* If we are running in the context of a slave, return ASAP:
* the slave key expiration is controlled by the master that will
* send us synthesized DEL operations for expired keys.
*
* Still we try to return the right information to the caller,
* that is, 0 if we think the key should be still valid, 1 if
* we think the key is expired at this time. */
return
1
;
}
if
(
!
keyIsExpired
(
db
,
key
))
return
0
;
/* If we are running in the context of a slave, instead of
* evicting the expired key from the database, we return ASAP:
* the slave key expiration is controlled by the master that will
* send us synthesized DEL operations for expired keys.
*
* Still we try to return the right information to the caller,
* that is, 0 if we think the key should be still valid, 1 if
* we think the key is expired at this time. */
if
(
server
.
masterhost
!=
NULL
)
return
1
;
/* Delete the key */
server
.
stat_expiredkeys
++
;
...
...
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