mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Speed up protocol synthesis for AOF
This commit is contained in:
parent
f990782f4d
commit
d1ec6c8b22
28
src/aof.c
28
src/aof.c
@ -110,17 +110,29 @@ void flushAppendOnlyFile(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sds catAppendOnlyGenericCommand(sds buf, int argc, robj **argv) {
|
sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
|
||||||
int j;
|
char buf[32];
|
||||||
buf = sdscatprintf(buf,"*%d\r\n",argc);
|
int len, j;
|
||||||
|
robj *o;
|
||||||
|
|
||||||
|
buf[0] = '*';
|
||||||
|
len = 1+ll2string(buf+1,sizeof(buf)-1,argc);
|
||||||
|
buf[len++] = '\r';
|
||||||
|
buf[len++] = '\n';
|
||||||
|
dst = sdscatlen(dst,buf,len);
|
||||||
|
|
||||||
for (j = 0; j < argc; j++) {
|
for (j = 0; j < argc; j++) {
|
||||||
robj *o = getDecodedObject(argv[j]);
|
o = getDecodedObject(argv[j]);
|
||||||
buf = sdscatprintf(buf,"$%lu\r\n",(unsigned long)sdslen(o->ptr));
|
buf[0] = '$';
|
||||||
buf = sdscatlen(buf,o->ptr,sdslen(o->ptr));
|
len = 1+ll2string(buf+1,sizeof(buf)-1,sdslen(o->ptr));
|
||||||
buf = sdscatlen(buf,"\r\n",2);
|
buf[len++] = '\r';
|
||||||
|
buf[len++] = '\n';
|
||||||
|
dst = sdscatlen(dst,buf,len);
|
||||||
|
dst = sdscatlen(dst,o->ptr,sdslen(o->ptr));
|
||||||
|
dst = sdscatlen(dst,"\r\n",2);
|
||||||
decrRefCount(o);
|
decrRefCount(o);
|
||||||
}
|
}
|
||||||
return buf;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
sds catAppendOnlyExpireAtCommand(sds buf, robj *key, robj *seconds) {
|
sds catAppendOnlyExpireAtCommand(sds buf, robj *key, robj *seconds) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user