]> git.saurik.com Git - redis.git/blobdiff - src/db.c
Merge pull request #304 from bradvoth/unstable
[redis.git] / src / db.c
index f7d93e08345ce6cfb2eb50361e8345ef4566e9b8..a0775af96506c19a14a9cf6d2bb9e78ace041bed 100644 (file)
--- a/src/db.c
+++ b/src/db.c
@@ -42,17 +42,22 @@ robj *lookupKey(redisDb *db, robj *key) {
          * a copy on write madness. */
         if (server.rdb_child_pid == -1 && server.aof_child_pid == -1)
             val->lru = server.lruclock;
          * a copy on write madness. */
         if (server.rdb_child_pid == -1 && server.aof_child_pid == -1)
             val->lru = server.lruclock;
-        server.stat_keyspace_hits++;
         return val;
     } else {
         return val;
     } else {
-        server.stat_keyspace_misses++;
         return NULL;
     }
 }
 
 robj *lookupKeyRead(redisDb *db, robj *key) {
         return NULL;
     }
 }
 
 robj *lookupKeyRead(redisDb *db, robj *key) {
+    robj *val;
+
     expireIfNeeded(db,key);
     expireIfNeeded(db,key);
-    return lookupKey(db,key);
+    val = lookupKey(db,key);
+    if (val == NULL)
+        server.stat_keyspace_misses++;
+    else
+        server.stat_keyspace_hits++;
+    return val;
 }
 
 robj *lookupKeyWrite(redisDb *db, robj *key) {
 }
 
 robj *lookupKeyWrite(redisDb *db, robj *key) {
@@ -110,7 +115,7 @@ void setKey(redisDb *db, robj *key, robj *val) {
     }
     incrRefCount(val);
     removeExpire(db,key);
     }
     incrRefCount(val);
     removeExpire(db,key);
-    touchWatchedKey(db,key);
+    signalModifiedKey(db,key);
 }
 
 int dbExists(redisDb *db, robj *key) {
 }
 
 int dbExists(redisDb *db, robj *key) {
@@ -483,9 +488,10 @@ long long getExpire(redisDb *db, robj *key) {
 void propagateExpire(redisDb *db, robj *key) {
     robj *argv[2];
 
 void propagateExpire(redisDb *db, robj *key) {
     robj *argv[2];
 
-    argv[0] = createStringObject("DEL",3);
+    argv[0] = shared.del;
     argv[1] = key;
     argv[1] = key;
-    incrRefCount(key);
+    incrRefCount(argv[0]);
+    incrRefCount(argv[1]);
 
     if (server.aof_state != REDIS_AOF_OFF)
         feedAppendOnlyFile(server.delCommand,db->id,argv,2);
 
     if (server.aof_state != REDIS_AOF_OFF)
         feedAppendOnlyFile(server.delCommand,db->id,argv,2);