]> git.saurik.com Git - redis.git/commitdiff
don't load value from VM for EXISTS
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 7 May 2010 09:40:26 +0000 (11:40 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 7 May 2010 09:40:26 +0000 (11:40 +0200)
TODO
redis.c

diff --git a/TODO b/TODO
index bdbe79742400ce5739278157d401cc14109db7d0..331c560aa75bcfce5bff9bbf9433f4c6423b5672 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,7 +15,6 @@ Virtual Memory sub-TODO:
 * Check if the page selection algorithm is working well
 * Divide swappability of objects by refcount
 * Use multiple open FDs against the VM file, one for thread.
-* EXISTS should avoid loading the object if possible without making the code too specialized.
 * vm-min-age <seconds> option
 * Make sure objects loaded from the VM are specially encoded when possible.
 * Check what happens performance-wise if instead to create threads again and again the same threads are reused forever. Note: this requires a way to disable this clients in the child, but waiting for empty new jobs queue can be enough.
diff --git a/redis.c b/redis.c
index c22a1c8c289e57346257a63ebb31c2912668cadf..19f431cf97c9c90b9b1bd1c2772ac9122d1d5b08 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -4343,7 +4343,12 @@ static void delCommand(redisClient *c) {
 }
 
 static void existsCommand(redisClient *c) {
-    addReply(c,lookupKeyRead(c->db,c->argv[1]) ? shared.cone : shared.czero);
+    expireIfNeeded(c->db,c->argv[1]);
+    if (dictFind(c->db->dict,c->argv[1])) {
+        addReply(c, shared.cone);
+    } else {
+        addReply(c, shared.czero);
+    }
 }
 
 static void selectCommand(redisClient *c) {