+
+ /* If we detecter we are hopeless about fitting something in memory
+ * we just swap every new key on disk. Directly...
+ * Note that's important to check for this condition before resorting
+ * to random sampling, otherwise we may try to swap already
+ * swapped keys. */
+ if (dataset_too_big) {
+ dictEntry *de = dictFind(d,keyobj);
+
+ /* de may be NULL since the key already expired */
+ if (de) {
+ keyobj = dictGetEntryKey(de);
+ o = dictGetEntryVal(de);
+
+ if (vmSwapObjectBlocking(keyobj,o) == REDIS_OK) {
+ dictGetEntryVal(de) = NULL;
+ }
+ }
+ continue;
+ }
+
+ /* If we have still some hope of having some value fitting memory
+ * then we try random sampling. */
+ if (!dataset_too_big && server.vm_enabled && (loadedkeys % 5000) == 0) {