Permalink
Browse files

Only incremnet stats for key miss/hit when the key is semantically ac…

…cessed in read-only.
  • Loading branch information...
antirez committed Feb 1, 2012
1 parent 58bfbd1 commit 29b3794231d5670a587fd42bec8061eb29e57023
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/db.c
View
@@ -37,17 +37,22 @@ robj *lookupKey(redisDb *db, robj *key) {
if (notify) handleClientsBlockedOnSwappedKey(db,key);
}
}
- server.stat_keyspace_hits++;
return val;
} else {
- server.stat_keyspace_misses++;
return NULL;
}
}
robj *lookupKeyRead(redisDb *db, robj *key) {
+ robj *val;
+
expireIfNeeded(db,key);
- return lookupKey(db,key);
+ val = lookupKey(db,key);
+ if (val == NULL)
+ server.stat_keyspace_misses++;
+ else
+ server.stat_keyspace_hits++;
+ return val;
}
robj *lookupKeyWrite(redisDb *db, robj *key) {

0 comments on commit 29b3794

Please sign in to comment.