]> git.saurik.com Git - redis.git/commitdiff
previouse INCR implementation restored, was actually faster for some reson not fully...
authorantirez <antirez@metal.(none)>
Fri, 10 Dec 2010 18:15:00 +0000 (19:15 +0100)
committerantirez <antirez@metal.(none)>
Fri, 10 Dec 2010 18:15:00 +0000 (19:15 +0100)
src/t_string.c

index bb6b4eceb5628dbf258e2452ab7e28a88851811c..39ee506d5e9586851ad8bf603859ca2c0b2d15b7 100644 (file)
@@ -144,24 +144,8 @@ void incrDecrCommand(redisClient *c, long long incr) {
 
     o = lookupKeyWrite(c->db,c->argv[1]);
     if (o != NULL && checkType(c,o,REDIS_STRING)) return;
-
-    /* Fast path if the object is integer encoded and is not shared. */
-    if (o && o->refcount == 1 && o->encoding == REDIS_ENCODING_INT) {
-        long long newval = ((long)o->ptr) + incr;
-
-        if (newval < 0 && newval >= REDIS_SHARED_INTEGERS &&
-            newval >= LONG_MIN && newval <= LONG_MAX) {
-            o->ptr = (void*) (long) newval;
-            touchWatchedKey(c->db,c->argv[1]);
-            server.dirty++;
-            addReplyLongLong(c,newval);
-            return;
-        }
-        /* ... else take the usual safe path */
-    }
-
-    /* Otherwise we create a new object and replace the old one. */
     if (getLongLongFromObjectOrReply(c,o,&value,NULL) != REDIS_OK) return;
+
     value += incr;
     o = createStringObjectFromLongLong(value);
     dbReplace(c->db,c->argv[1],o);