handleClientsBlockedOnSwappedKey(j->db,j->key);
freeIOJob(j);
} else if (j->type == REDIS_IOJOB_SAVE) {
- redisAssert(j->val->storage == REDIS_DS_SAVING);
- j->val->storage = REDIS_DS_MEMORY;
+ if (j->val) {
+ redisAssert(j->val->storage == REDIS_DS_SAVING);
+ j->val->storage = REDIS_DS_MEMORY;
+ }
freeIOJob(j);
}
processed++;
j->val = dsGet(j->db,j->key,&expire);
if (j->val) j->expire = expire;
} else if (j->type == REDIS_IOJOB_SAVE) {
- redisAssert(j->val->storage == REDIS_DS_SAVING);
- if (j->val)
+ if (j->val) {
+ redisAssert(j->val->storage == REDIS_DS_SAVING);
dsSet(j->db,j->key,j->val);
- else
+ } else {
dsDel(j->db,j->key);
+ }
}
/* Done: insert the job into the processed queue */
}
}
+/* ============ Negative caching for diskstore objects ====================== */
+/* Since accesses to keys that don't exist with disk store cost us a disk
+ * access, we need to cache names of keys that do not exist but are frequently
+ * accessed. */
+int cacheKeyMayExist(redisDb *db, robj *key) {
+ /* FIXME: for now we just always return true. */
+ return 1;
+}
+
/* ============ Virtual Memory - Blocking clients on missing keys =========== */
/* This function makes the clinet 'c' waiting for the key 'key' to be loaded.