* 将member元素从source集合移动到destination集合 * @param[in] source 源集合键 * @param[in] destination 目的集合键 * @param[in] member 集合元素 * @return 成功true,失败false * @see * @note */
| 3271 | * @note |
| 3272 | */ |
| 3273 | bool RedisClient::smove(const QString & source, const QString & destination, const QString & member) { |
| 3274 | _sErrorInfo.clear(); |
| 3275 | if(source.trimmed().isEmpty()) { |
| 3276 | _sErrorInfo = "destkey is empty"; |
| 3277 | return false; |
| 3278 | } |
| 3279 | if(destination.trimmed().isEmpty()) { |
| 3280 | _sErrorInfo = "destkey is empty"; |
| 3281 | return false; |
| 3282 | } |
| 3283 | |
| 3284 | _vCmdList.clear(); |
| 3285 | _vCmdList.push_back("SMOVE"); |
| 3286 | _vCmdList.push_back(source); |
| 3287 | _vCmdList.push_back(destination); |
| 3288 | _vCmdList.push_back(member); |
| 3289 | |
| 3290 | _cmdResult = command(_vCmdList); |
| 3291 | if(_cmdResult[0] == '-') { |
| 3292 | if(parseRespError(_cmdResult,_sValue)) |
| 3293 | _sErrorInfo = _sValue; |
| 3294 | else |
| 3295 | _sErrorInfo = "parser resp error info failed"; |
| 3296 | _bRet = false; |
| 3297 | } else if(_cmdResult[0] == ':') { |
| 3298 | if(parseRespInteger(_cmdResult,_llRet)) { |
| 3299 | if(_llRet) |
| 3300 | _bRet = true; |
| 3301 | else |
| 3302 | _bRet = false; |
| 3303 | } else { |
| 3304 | _sErrorInfo = "parser resp integer info failed"; |
| 3305 | _bRet = false; |
| 3306 | } |
| 3307 | } else { |
| 3308 | _bRet = false; |
| 3309 | _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0]; |
| 3310 | } |
| 3311 | return _bRet; |
| 3312 | } |
| 3313 | |
| 3314 | /** |
| 3315 | * 判断member元素是否集合key的成员 |