Only incremnet stats for key miss/hit when the key is semantically accessed in read-only.

This commit is contained in:
antirez 2012-02-01 21:47:41 +01:00
parent 58bfbd1fa4
commit 29b3794231

View File

@ -37,17 +37,22 @@ robj *lookupKey(redisDb *db, robj *key) {
if (notify) handleClientsBlockedOnSwappedKey(db,key); if (notify) handleClientsBlockedOnSwappedKey(db,key);
} }
} }
server.stat_keyspace_hits++;
return val; return val;
} else { } else {
server.stat_keyspace_misses++;
return NULL; return NULL;
} }
} }
robj *lookupKeyRead(redisDb *db, robj *key) { robj *lookupKeyRead(redisDb *db, robj *key) {
robj *val;
expireIfNeeded(db,key); 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) { robj *lookupKeyWrite(redisDb *db, robj *key) {