- time_t expire;
- robj *val;
-
- /* Key not found in the in memory hash table, but if disk store is
- * enabled we may have this key on disk. If so load it in memory
- * in a blocking way. */
- if (server.ds_enabled && cacheKeyMayExist(db,key)) {
- long flags = cacheScheduleIOGetFlags(db,key);
-
- /* They key is not in cache, but it has a SAVE op in queue?
- * The only possibility is that the key was deleted, since
- * dirty keys are not evicted. */
- if (flags & REDIS_IO_SAVE) {
- server.stat_keyspace_misses++;
- return NULL;
- }
-
- /* At this point we need to blocking load the key in memory.
- * The first thing we do is waiting here if the key is busy. */
- if (flags & REDIS_IO_SAVEINPROG) {
- redisLog(REDIS_DEBUG,"Lookup found a key in SAVEINPROG state. Waiting (while force loading).");
- lookupWaitBusyKey(db,key);
- }
-
- redisLog(REDIS_DEBUG,"Force loading key %s via lookup", key->ptr);
- val = dsGet(db,key,&expire);
- if (val) {
- dbAdd(db,key,val);
- if (expire != -1) setExpire(db,key,expire);
- server.stat_keyspace_hits++;
- return val;
- } else {
- cacheSetKeyDoesNotExist(db,key);
- }
- }
- server.stat_keyspace_misses++;