mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Simplify part of the #5470 patch.
This commit is contained in:
parent
3c89fb5ffd
commit
8749fc3f67
11
src/db.c
11
src/db.c
@ -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:
|
||||
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. */
|
||||
return 1;
|
||||
}
|
||||
if (server.masterhost != NULL) return 1;
|
||||
|
||||
/* Delete the key */
|
||||
server.stat_expiredkeys++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user