X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ff2145adac3108196bf6afcab61a5babc64ce4ed..b80b1c5914435c3a013cfe9b19e39f9de35ab06e:/src/db.c diff --git a/src/db.c b/src/db.c index 0b6ce045..fc366b07 100644 --- a/src/db.c +++ b/src/db.c @@ -40,19 +40,24 @@ robj *lookupKey(redisDb *db, robj *key) { /* Update the access time for the aging algorithm. * Don't do it if we have a saving child, as this will trigger * a copy on write madness. */ - if (server.bgsavechildpid == -1 && server.aof_child_pid == -1) + 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) { @@ -110,7 +115,7 @@ void setKey(redisDb *db, robj *key, robj *val) { } incrRefCount(val); removeExpire(db,key); - touchWatchedKey(db,key); + signalModifiedKey(db,key); } int dbExists(redisDb *db, robj *key) { @@ -210,15 +215,15 @@ void flushallCommand(redisClient *c) { signalFlushedDb(-1); server.dirty += emptyDb(); addReply(c,shared.ok); - if (server.bgsavechildpid != -1) { - kill(server.bgsavechildpid,SIGKILL); - rdbRemoveTempFile(server.bgsavechildpid); + if (server.rdb_child_pid != -1) { + kill(server.rdb_child_pid,SIGKILL); + rdbRemoveTempFile(server.rdb_child_pid); } if (server.saveparamslen > 0) { /* Normally rdbSave() will reset dirty, but we don't want this here * as otherwise FLUSHALL will not be replicated nor put into the AOF. */ int saved_dirty = server.dirty; - rdbSave(server.dbfilename); + rdbSave(server.rdb_filename); server.dirty = saved_dirty; } server.dirty++;