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

Method rpushx

src/RedisView/RedisLib/RedisClient.cpp:2077–2108  ·  view source on GitHub ↗

* 将值value插入到列表key的表尾,当且仅当key存在并且是一个列表, * 当key不存在时,RPUSHX 命令什么也不做 * @param[in] key 链表键值 * @param[in] value 链表添加一个或多个键值 * @param[out] llRet 链表长度 * @return 成功true,失败false * @see * @note */

Source from the content-addressed store, hash-verified

2075 * @note
2076 */
2077bool RedisClient::rpushx(const QString & key, const QString & value, qlonglong & llRet) {
2078 _sErrorInfo.clear();
2079 if(key.trimmed().isEmpty()) {
2080 _sErrorInfo = "key is empty";
2081 return false;
2082 }
2083
2084 _vCmdList.clear();
2085 _vCmdList.push_back("RPUSHX");
2086 _vCmdList.push_back(key);
2087 _vCmdList.push_back(value);
2088
2089 _cmdResult = command(_vCmdList);
2090 if(_cmdResult[0] == '-') {
2091 if(parseRespError(_cmdResult,_sValue))
2092 _sErrorInfo = _sValue;
2093 else
2094 _sErrorInfo = "parser resp error info failed";
2095 _bRet = false;
2096 } else if(_cmdResult[0] == ':') {
2097 if(parseRespInteger(_cmdResult,llRet)) {
2098 _bRet = true;
2099 } else {
2100 _sErrorInfo = "parser resp integer info failed";
2101 _bRet = false;
2102 }
2103 } else {
2104 _bRet = false;
2105 _sErrorInfo = QString("parser resp type failed:") + _cmdResult[0];
2106 }
2107 return _bRet;
2108}
2109
2110/**
2111 * 当且仅当key存在并且是一个列表时,将值 value插入到列表 key的表头。

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected