0
我嘗試在Linux上使用redis在Linux上使用C++,如何在C++上使用「rpush」,「lpush」,「rpop」,「lpop」我寫像這樣的:如何使用Redis上的列表使用hiredis開發使用C++
this->_reply = (redisReply *) redisCommand(this->_context, "LPUSH %s %s", key.c_str(), value.c_str());
this->_reply = (redisReply *) redisCommand(this->_context, "RPOP %s", key.c_str());
但它沒有成功,而「這 - > _ reply-> STR」說「WRONGTYPE行動,打擊的關鍵抱着一種錯誤的價值」
如何使用這些方法?謝謝
也許您之前已經將相同的密鑰添加到redis實例中,而不是列表以外的其他密鑰? – nos
@nos當我使用「刪除鍵」刪除鍵後,再次運行它,並有一個錯誤表示「拋出'std :: logic_error'實例後調用終止什麼():basic_string :: _ S_construct空無效」什麼我應該怎麼做? – wikios
@Gerhardh對不起,我忘了它並且已經刪除它 – wikios