* 迭代有序集合中的键 * @param[in] key 有序集合键 * @param[in] pattern 值匹配模式 * @param[out] value 扫描结果 * @param[in] cursor 扫描游标 * @param[in] count 每次扫描返回数 * @return 成功true,失败false * @see * @note */
| 4576 | * @note |
| 4577 | */ |
| 4578 | bool RedisClient::zscan(const QString& key, const QString &pattern, RespType &value, qulonglong cursor, qulonglong count) { |
| 4579 | _sErrorInfo.clear(); |
| 4580 | if(key.trimmed().isEmpty()) { |
| 4581 | _sErrorInfo = "key is empty"; |
| 4582 | return false; |
| 4583 | } |
| 4584 | |
| 4585 | _vCmdList.clear(); |
| 4586 | _vCmdList.push_back("ZSCAN"); |
| 4587 | _vCmdList.push_back(key); |
| 4588 | _vCmdList.push_back(QString::number(cursor)); |
| 4589 | if(!pattern.isEmpty()) { |
| 4590 | _vCmdList.push_back("MATCH"); |
| 4591 | _vCmdList.push_back(pattern); |
| 4592 | } |
| 4593 | _vCmdList.push_back("COUNT"); |
| 4594 | _vCmdList.push_back(QString::number(count)); |
| 4595 | |
| 4596 | _cmdResult = command(_vCmdList); |
| 4597 | if(_cmdResult[0] == '-') { |
| 4598 | if(parseRespError(_cmdResult,_sValue)) |
| 4599 | _sErrorInfo = _sValue; |
| 4600 | else |
| 4601 | _sErrorInfo = "parser resp error info failed"; |
| 4602 | _bRet = false; |
| 4603 | } else if(_cmdResult[0] == '*') { |
| 4604 | if(parseResp(_cmdResult,value)) { |
| 4605 | _bRet = true; |
| 4606 | } else { |
| 4607 | _sErrorInfo = "parser resp bulk string info failed"; |
| 4608 | _bRet = false; |
| 4609 | } |
| 4610 | } else { |
| 4611 | _bRet = false; |
| 4612 | _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0]; |
| 4613 | } |
| 4614 | return _bRet; |
| 4615 | } |
| 4616 | |
| 4617 | /** |
| 4618 | * 迭代希键中的键 |
no test coverage detected