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

Method encoding

src/RedisView/RedisLib/RedisClient.cpp:2376–2411  ·  view source on GitHub ↗

* 获取编码 * @param[in] key 键 * @param[out] value 结果 * @return 成功true,失败false * @see * @note */

Source from the content-addressed store, hash-verified

2374 * @note
2375 */
2376bool RedisClient::encoding(const QString& key, QByteArray & value) {
2377 _sErrorInfo.clear();
2378 if(key.trimmed().isEmpty()) {
2379 _sErrorInfo = "key is empty";
2380 return false;
2381 }
2382
2383 _vCmdList.clear();
2384 _vCmdList.push_back("OBJECT");
2385 _vCmdList.push_back("ENCODING");
2386 _vCmdList.push_back(key);
2387
2388 _cmdResult = command(_vCmdList);
2389 if(_cmdResult[0] == '-') {
2390 if(parseRespError(_cmdResult,_sValue))
2391 _sErrorInfo = _sValue;
2392 else
2393 _sErrorInfo = "parser resp error info failed";
2394 _bRet = false;
2395 } else if(_cmdResult[0] == '$') {
2396 if(parseRespBulkString(_cmdResult,value, _iRet)) {
2397 if(_iRet == -1) {
2398 _bRet = false;
2399 _sErrorInfo = "value is nil";
2400 } else
2401 _bRet = true;
2402 } else {
2403 _sErrorInfo = "parser resp bulk string info failed";
2404 _bRet = false;
2405 }
2406 } else {
2407 _bRet = false;
2408 _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0];
2409 }
2410 return _bRet;
2411}
2412
2413/**
2414 * 它是LPOP命令的阻塞版本,当给定列表内没有任何元素可供弹出的时候,

Callers 1

treeClickedMethod · 0.45

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected