{"flushdb",1,REDIS_CMD_INLINE|REDIS_CMD_RETCODEREPLY},
{"flushall",1,REDIS_CMD_INLINE|REDIS_CMD_RETCODEREPLY},
{"sort",-2,REDIS_CMD_INLINE|REDIS_CMD_MULTIBULKREPLY},
- {"version",1,REDIS_CMD_INLINE|REDIS_CMD_SINGLELINEREPLY},
+ {"info",1,REDIS_CMD_INLINE|REDIS_CMD_BULKREPLY},
+ {"mget",-2,REDIS_CMD_INLINE|REDIS_CMD_MULTIBULKREPLY},
{NULL,0,0}
};
static void sortCommand(redisClient *c);
static void lremCommand(redisClient *c);
static void infoCommand(redisClient *c);
+static void mgetCommand(redisClient *c);
/*================================= Globals ================================= */
{"exists",existsCommand,2,REDIS_CMD_INLINE},
{"incr",incrCommand,2,REDIS_CMD_INLINE},
{"decr",decrCommand,2,REDIS_CMD_INLINE},
+ {"mget",mgetCommand,-2,REDIS_CMD_INLINE},
{"rpush",rpushCommand,3,REDIS_CMD_BULK},
{"lpush",lpushCommand,3,REDIS_CMD_BULK},
{"rpop",rpopCommand,2,REDIS_CMD_INLINE},
}
}
+static void mgetCommand(redisClient *c) {
+ dictEntry *de;
+ int j;
+
+ addReplySds(c,sdscatprintf(sdsempty(),"%d\r\n",c->argc-1));
+ for (j = 1; j < c->argc; j++) {
+ de = dictFind(c->dict,c->argv[j]);
+ if (de == NULL) {
+ addReply(c,shared.minus1);
+ } else {
+ robj *o = dictGetEntryVal(de);
+
+ if (o->type != REDIS_STRING) {
+ addReply(c,shared.minus1);
+ } else {
+ addReplySds(c,sdscatprintf(sdsempty(),"%d\r\n",(int)sdslen(o->ptr)));
+ addReply(c,o);
+ addReply(c,shared.crlf);
+ }
+ }
+ }
+}
+
static void incrDecrCommand(redisClient *c, int incr) {
dictEntry *de;
long long value;
);
addReplySds(c,sdscatprintf(sdsempty(),"%d\r\n",sdslen(info)));
addReplySds(c,info);
+ addReply(c,shared.crlf);
}
/* =============================== Replication ============================= */