void dbAdd(redisDb *db, robj *key, robj *val) {
sds copy = sdsdup(key->ptr);
int retval = dictAdd(db->dict, copy, val);
+ val->archived = 0;
redisAssertWithInfo(NULL,key,retval == REDIS_OK);
}
}
int dbExists(redisDb *db, robj *key) {
- return dictFind(db->dict,key->ptr) != NULL;
+ if (dictFind(db->dict,key->ptr) != NULL)
+ return 1;
+ if (recover(db, key) != NULL)
+ return 1;
+ return 0;
}
/* Return a random key, in form of a Redis object.
}
/* Delete a key, value, and associated expiration entry if any, from the DB */
-int dbDelete(redisDb *db, robj *key) {
+int dbDeleteSoft(redisDb *db, robj *key) {
/* Deleting an entry from the expires dict will not free the sds of
* the key, because it is shared with the main dictionary. */
if (dictSize(db->expires) > 0) dictDelete(db->expires,key->ptr);
}
}
+/* Delete a key, value, and associated expiration entry if any, even archived */
+int dbDelete(redisDb *db, robj *key) {
+ purge(key);
+ return dbDeleteSoft(db, key);
+}
+
long long emptyDb() {
int j;
long long removed = 0;
}
}
dictReleaseIterator(di);
+
+ rummage(c, &numkeys);
+
setDeferredMultiBulkLength(c,replylen,numkeys);
}