标签:
最近遇到了一个问题,使用incr计数,存进去了一个数字(int类型),但是因为是序列化之后存进去的,调用incr方法时候报错了:
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range
at redis.clients.jedis.Protocol.processError(Protocol.java:115)
at redis.clients.jedis.Protocol.process(Protocol.java:133)
at redis.clients.jedis.Protocol.read(Protocol.java:202)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:210)
at redis.clients.jedis.Jedis.incrBy(Jedis.java:556)
at com.dangdang.framework.redis.jedis.cluster.core.SingleJedisClientImpl.incrBy(SingleJedisClientImpl.java:119)
... 81 common frames omitted
解决:存进去时直接使用set(String key,String value),不序列化value。
ERR value is not an integer or out of range
标签:
原文地址:http://my.oschina.net/u/1377774/blog/492024