]> git.saurik.com Git - redis.git/blobdiff - src/db.c
Query the archive to provide a complete KEYS list.
[redis.git] / src / db.c
index ad6e7114c92bdb1da52f01e99fbe7b3955a65301..da22cc9806db11bf44a86e791d19e933c6e4dd02 100644 (file)
--- a/src/db.c
+++ b/src/db.c
@@ -93,6 +93,7 @@ robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply) {
 void dbAdd(redisDb *db, robj *key, robj *val) {
     sds copy = sdsdup(key->ptr);
     int retval = dictAdd(db->dict, copy, val);
 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);
  }
 
     redisAssertWithInfo(NULL,key,retval == REDIS_OK);
  }
@@ -127,7 +128,11 @@ void setKey(redisDb *db, robj *key, robj *val) {
 }
 
 int dbExists(redisDb *db, robj *key) {
 }
 
 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.
 }
 
 /* Return a random key, in form of a Redis object.
@@ -157,7 +162,7 @@ robj *dbRandomKey(redisDb *db) {
 }
 
 /* Delete a key, value, and associated expiration entry if any, from the DB */
 }
 
 /* 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);
     /* 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);
@@ -168,6 +173,12 @@ int dbDelete(redisDb *db, robj *key) {
     }
 }
 
     }
 }
 
+/* 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;
 long long emptyDb() {
     int j;
     long long removed = 0;
@@ -306,6 +317,9 @@ void keysCommand(redisClient *c) {
         }
     }
     dictReleaseIterator(di);
         }
     }
     dictReleaseIterator(di);
+
+    rummage(c, &numkeys);
+
     setDeferredMultiBulkLength(c,replylen,numkeys);
 }
 
     setDeferredMultiBulkLength(c,replylen,numkeys);
 }