环境:
centos 6.0 64位
redis 5.0.5

问题:

(error) WRONGTYPE Operation against a key holding the wrong kind of value
#(错误)对持有错误类型值的键进行错误类型操作

原因:

#使用了set的命令对zset数据类型的key进行操作导致报错
127.0.0.1:6379> smembers salary #smembers 查看指定set的值
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379> type salary
zset

正确方法:

127.0.0.1:6379> ZRANGE salary 0 -1 withscores #使用range命令获取有序集合key中指定范围的元素
1) "lisi"
2) "1000"
3) "shangzhan"
4) "2000"
5) "wangwu"
6) "5000"

相关文章:

  • 2021-09-21
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
猜你喜欢
  • 2021-08-29
  • 2021-10-04
  • 2021-07-02
  • 2021-09-15
  • 2021-06-11
相关资源
相似解决方案