Skip to content

Commit

Permalink
if we read a expired key, misses++
Browse files Browse the repository at this point in the history
  • Loading branch information
soloestoy committed Oct 19, 2018
1 parent f30b18f commit 5ddd507
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
/* Key expired. If we are in the context of a master, expireIfNeeded()
* returns 0 only when the key does not exist at all, so it's safe
* to return NULL ASAP. */
if (server.masterhost == NULL) return NULL;
if (server.masterhost == NULL) {
server.stat_keyspace_misses++;
return NULL;
}

/* However if we are in the context of a slave, expireIfNeeded() will
* not really try to expire the key, it only returns information
Expand All @@ -121,6 +124,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
server.current_client->cmd &&
server.current_client->cmd->flags & CMD_READONLY)
{
server.stat_keyspace_misses++;
return NULL;
}
}
Expand Down

0 comments on commit 5ddd507

Please sign in to comment.