* 返回一个集合的全部成员,该集合是所有给定集合之间的交集 * 不存在的key被视为空集 * @param[in] keys 一个或多个集合 * @param[out] value 集合交集 * @return 成功true,失败false * @see * @note */
| 4246 | * @note |
| 4247 | */ |
| 4248 | bool RedisClient::sinter(const QString & keys, QList<QByteArray> & value) { |
| 4249 | _sErrorInfo.clear(); |
| 4250 | if(keys.trimmed().isEmpty()) { |
| 4251 | _sErrorInfo = "key is empty"; |
| 4252 | return false; |
| 4253 | } |
| 4254 | |
| 4255 | _vCmdList.clear(); |
| 4256 | _vCmdList.push_back("SINTER"); |
| 4257 | _vCmdList.push_back(keys); |
| 4258 | |
| 4259 | _cmdResult = command(_vCmdList); |
| 4260 | if(_cmdResult[0] == '-') { |
| 4261 | if(parseRespError(_cmdResult,_sValue)) |
| 4262 | _sErrorInfo = _sValue; |
| 4263 | else |
| 4264 | _sErrorInfo = "parser resp error info failed"; |
| 4265 | _bRet = false; |
| 4266 | } else if(_cmdResult[0] == '*') { |
| 4267 | if(parseRespSingelArray(_cmdResult,value, _iRet)) { |
| 4268 | _bRet = true; |
| 4269 | } else { |
| 4270 | _sErrorInfo = "parser resp bulk string info failed"; |
| 4271 | _bRet = false; |
| 4272 | } |
| 4273 | } else { |
| 4274 | _bRet = false; |
| 4275 | _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0]; |
| 4276 | } |
| 4277 | return _bRet; |
| 4278 | } |
| 4279 | |
| 4280 | /** |
| 4281 | * 返回一个集合的全部成员,该集合是所有给定集合之间的并集 |