MCPcopy Create free account
hub / github.com/cc20110101/RedisView / sinterstore

Method sinterstore

src/RedisView/RedisLib/RedisClient.cpp:3459–3494  ·  view source on GitHub ↗

* 将给定集合之间的交集存储在指定的destkey集合中。如果指定的destkey集合已经存在,则将其覆盖 * @param[in] destkey 目的集合键 * @param[in] keys 要加入目的集合的集合key,多个可空格分割 * @param[out] llRet 结果集中的元素数量 * @return 成功true,失败false * @see * @note */

Source from the content-addressed store, hash-verified

3457 * @note
3458 */
3459bool RedisClient::sinterstore(const QString & destkey, const QString & keys, qlonglong & llRet) {
3460 _sErrorInfo.clear();
3461 if(destkey.trimmed().isEmpty()) {
3462 _sErrorInfo = "destkey is empty";
3463 return false;
3464 }
3465 if(keys.trimmed().isEmpty()) {
3466 _sErrorInfo = "keys is empty";
3467 return false;
3468 }
3469
3470 _vCmdList.clear();
3471 _vCmdList.push_back("SINTERSTORE");
3472 _vCmdList.push_back(destkey);
3473 _vCmdList.push_back(keys);
3474
3475 _cmdResult = command(_vCmdList);
3476 if(_cmdResult[0] == '-') {
3477 if(parseRespError(_cmdResult,_sValue))
3478 _sErrorInfo = _sValue;
3479 else
3480 _sErrorInfo = "parser resp error info failed";
3481 _bRet = false;
3482 } else if(_cmdResult[0] == ':') {
3483 if(parseRespInteger(_cmdResult,llRet)) {
3484 _bRet = true;
3485 } else {
3486 _sErrorInfo = "parser resp integer info failed";
3487 _bRet = false;
3488 }
3489 } else {
3490 _bRet = false;
3491 _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0];
3492 }
3493 return _bRet;
3494}
3495
3496/**
3497 * 将给定集合的并集存储在指定的集合destination中。如果destination已经存在,则将其覆盖。

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected