我尝试在带有C++的Linux上使用带有redis的列表,如何在C++上使用"rpush","lpush","rpop","lpop“?我是这样写的:
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());但是它没有成功,并且"this->_reply->str“表示”对持有错误类型的值的键执行WRONGTYPE操作“
如何使用这些方法?谢谢
发布于 2017-08-31 16:31:50
WRONGTYPE Operation against a key holding the wrong kind of value的意思是键持有的不是一个列表,所以当你想在这个键上做lpush时,它会报错。
您可以先使用TYPE key命令使用redis-cli测试密钥的类型。
https://stackoverflow.com/questions/45975991
复制相似问题