Redis WRONGTYPE Operation against a key holding the wrong kind of value

前端之家收集整理的这篇文章主要介绍了Redis WRONGTYPE Operation against a key holding the wrong kind of value前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

使用redis时使用以下命令时,redis提示错误:WRONGTYPE Operation against a key holding the wrong kind of value

127.0.0.1:6379> rpush aaa item
WRONGTYPE Operation against a key holding the wrong kind of value

报错的原因是因为reids中已经有aaa这个key,而这个key对应的值类型并不是list集合,而是string,因此使用rpush时刨除错误

解决办法

    1.删除之前aaa这个key。再重新写入

    2.使用redis中未有的key。


猜你在找的Redis相关文章