ERR value is not an integer or out of range


最近遇到了一个问题,使用incr计数,存进去了一个数字(Integer类型),可是由于默认是把value(Integer类型)序列化以后存进去的,调用incr方法时候报错了:java

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)
    ... 81 common frames omitted

解决:存进去时直接使用set(String key,String value),不序列化value。redis

相关文章
相关标签/搜索