Chinaunix

标题: redis get 报错:WRONGTYPE [打印本页]

作者: cxytz01    时间: 2013-12-03 20:58
标题: redis get 报错:WRONGTYPE
本帖最后由 cxytz01 于 2013-12-03 21:07 编辑

127.0.0.1:6369> get user_id
(error) WRONGTYPE Operation against a key holding the wrong kind of value


127.0.0.1:6369> sort user_id alpha
1) "1"
2) "2"
3) "222"
4) "59230"


只要是list都会报错
lpush a "www.xxx.com"
get a
(error) WRONGTYPE Operation against a key holding the wrong kind of value

sort a
(error) WRONGTYPE Operation against a key holding the wrong kind of value

sort a alpha
就可以了

或者sort a by xxxx(不存在的key)
也可以

作者: cxytz01    时间: 2013-12-04 14:19
知道了。get仅能用于string,和int数据类型。
作者: cjfeii    时间: 2016-04-22 17:08
终于看到一个解决问题之后来回帖的了,赞一个  




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2