redis异常在这里
来源:互联网 发布:极客学院java百度网盘 编辑:程序博客网 时间:2024/06/05 11:29
err protocol error: invalid multibulk length
finally, I figured it out.
the length of args of the API command MSET can’t be bigger than 1024 * 1024, so the length of the array KeyValuePair
(RedisKey, RedisValue)[] values cant be bigger than 524288, so I limit it to 524287, then it works.
I hope this would be helpful others.
redis官方源码:
/* We know for sure there is a whole line since newline != NULL, * so go ahead and find out the multi bulk length. */ redisAssertWithInfo(c,NULL,c->querybuf[0] == '*'); ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll); if (!ok || ll > 1024*1024) { addReplyError(c,"Protocol error: invalid multibulk length"); setProtocolError(c,pos); return REDIS_ERR; }
存储的时候分段吧
public void storeResult(Integer totalCount, String matrixActionKey, List<String> resultList, String blueBall) { /* 过滤前的个数*/ if (totalCount >= 10000) { /* 红球结果 过期时间 5分钟*/ Boolean isDiv = Boolean.TRUE; while (isDiv) { List<String> storeList; if (resultList.size() - (524287) > 0) { storeList = resultList.subList(0, 524287 - 1); resultList = resultList.subList(524287, resultList.size() - 1); } else { storeList = resultList; isDiv = Boolean.FALSE; } redisService.kryoLPushStr(matrixActionKey, storeList.toArray(new String[storeList.size()])); } redisService.expire(matrixActionKey, RedisConstant.EXPIRE_TIME_SECOND_FIVE_MINUTE); /* 篮球号码存一下*/ redisService.kryoSetEx(RedisConstant.getMatrixActionBlueKey(matrixActionKey), RedisConstant .EXPIRE_TIME_SECOND_FIVE_MINUTE, blueBall); } }
阅读全文
0 0
- redis异常在这里
- 在这里
- redis安装,命令详解,配置详解,java客户端如何使用,都在这里
- 学习Redis从这里开始
- 学习Redis从这里开始
- 学习Redis从这里开始
- 学习Redis从这里开始
- 当企图delete没有分配内存的指针时,会在这里HeapFree处异常
- 在这里开辟新天地
- 把家安在这里!
- 我,在这里
- 在这里安个家咯
- 以后在这里定居
- 在这里做技术
- 在这里安个家怎么样?
- 决定在这里住下来!!!
- 在这里安家了!!!
- 在这里安家
- Java1.8环境变量配置
- 欢迎使用CSDN-markdown编辑器
- 1161:A+B
- JVM系列二:GC策略&内存申请、对象衰老
- PHP 5.3.0以上推荐使用mysqlnd驱动
- redis异常在这里
- 【服务器】java.lang.OutOfMemoryError
- 布局随笔
- JAVA操作HBASE数据操作详解
- Java中的Filter过滤器
- 算法导论习题自作2.1-2
- 【JZOJ5296】【清华集训模拟】Sequence(整体二分)
- HDU 1690 Bus System(Floyd)
- 浅谈对handle的理解