diff options
author | antirez <antirez@gmail.com> | 2012-02-01 21:47:41 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2012-02-01 21:51:20 +0100 |
commit | b80b1c5914435c3a013cfe9b19e39f9de35ab06e (patch) | |
tree | a1bd47d45cdc0928df2ab7a58cdc9497f7762781 /src | |
parent | c17947287afe5b081400679dbe9882cd4e95776b (diff) | |
download | redis-b80b1c5914435c3a013cfe9b19e39f9de35ab06e.tar.gz |
Only incremnet stats for key miss/hit when the key is semantically accessed in read-only.
Diffstat (limited to 'src')
-rw-r--r-- | src/db.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -42,17 +42,22 @@ robj *lookupKey(redisDb *db, robj *key) { * a copy on write madness. */ if (server.rdb_child_pid == -1 && server.aof_child_pid == -1) val->lru = server.lruclock; - 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) { |