| 16 | } |
| 17 | |
| 18 | bool RedisRespParser::packRespCmd(const QList<QString> &vInCmd, QByteArray &sOutRespCmd) { |
| 19 | if(vInCmd.isEmpty()) |
| 20 | return false; |
| 21 | |
| 22 | sOutRespCmd.clear(); |
| 23 | sOutRespCmd.append("*"); |
| 24 | sOutRespCmd.append(QByteArray::number(vInCmd.size())); |
| 25 | sOutRespCmd.append("\r\n"); |
| 26 | for (int i = 0; i < vInCmd.size(); ++i) |
| 27 | { |
| 28 | sOutRespCmd.append("$"); |
| 29 | sOutRespCmd.append(QByteArray::number(vInCmd[i].toLocal8Bit().length())); |
| 30 | sOutRespCmd.append("\r\n"); |
| 31 | sOutRespCmd.append(vInCmd[i].toLocal8Bit()); |
| 32 | sOutRespCmd.append("\r\n"); |
| 33 | } |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | bool RedisRespParser::packRespCmd(const QString &sInCmd, QByteArray &sOutRespCmd) |
| 38 | { |