提交 d68ed120 编写于 作者: A antirez

INCRBY/DECRBY now support 64bit increments, with tests

上级 f5785ae9
2009-04-23 RANDOMKEY regression test added
2009-04-23 dictGetRandomKey bug fixed, RANDOMKEY will not block the server anymore
2009-04-22 FLUSHALL/FLUSHDB no longer sync on disk. Just increment the dirty counter by the number of elements removed, that will probably trigger a background saving operation
2009-04-21 forgot to comment testing code in PHP lib. Now it is ok
2009-04-21 PHP client ported to PHP5 and fixed
......
BEFORE REDIS 1.0.0-rc1
- What happens if the saving child gets killed instead to end normally? Handle this.
- Fix INCRBY argument that is limited to 32bit int.
- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
- Add a new field as INFO output: bgsaveinprogress
- Remove max number of args limit
......@@ -24,6 +23,7 @@ This command should be smart and don't use too much memory, that is, take two co
- Document replication
- Objects sharing configuration, add the directive "objectsharingpool <size>"
- Make sure to convert all the fstat() calls to 64bit versions.
- SINTERCOUNT, SUNIONCOUNT, SDIFFCOUNT
FUTURE HINTS
......
......@@ -2195,7 +2195,7 @@ static void mgetCommand(redisClient *c) {
}
}
static void incrDecrCommand(redisClient *c, int incr) {
static void incrDecrCommand(redisClient *c, long long incr) {
long long value;
int retval;
robj *o;
......@@ -2237,12 +2237,12 @@ static void decrCommand(redisClient *c) {
}
static void incrbyCommand(redisClient *c) {
int incr = atoi(c->argv[2]->ptr);
long long incr = strtoll(c->argv[2]->ptr, NULL, 10);
incrDecrCommand(c,incr);
}
static void decrbyCommand(redisClient *c) {
int incr = atoi(c->argv[2]->ptr);
long long incr = strtoll(c->argv[2]->ptr, NULL, 10);
incrDecrCommand(c,-incr);
}
......
......@@ -101,6 +101,21 @@ proc main {server port} {
$r incr novar
} {101}
test {INCR over 32bit value} {
$r set novar 17179869184
$r incr novar
} {17179869185}
test {INCRBY over 32bit value with over 32bit increment} {
$r set novar 17179869184
$r incrby novar 17179869184
} {34359738368}
test {DECRBY over 32bit value with over 32bit increment, negative res} {
$r set novar 17179869184
$r decrby novar 17179869185
} {-1}
test {SETNX target key missing} {
$r setnx novar2 foobared
$r get novar2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册