redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range

incrment方法:

设置:

 <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="keySerializer">
<bean
class="org.springframework.data.redis.serializer.StringRedisSerializer" />
</property>
<property name="valueSerializer">
<bean
class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
</property>
<property name="hashKeySerializer">
<bean
class="org.springframework.data.redis.serializer.StringRedisSerializer" />
</property>
<property name="hashValueSerializer">
<bean
class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
</property>
</bean>

方法变动:

 public static Boolean setStringValueByKeyInNxModeRateLimit(String key, String value,
long interval) {
logger.info("进入setStringValueByKeyInNxMode:时间为"+interval);
ApplicationContext context = ApplicationContextHolder.getContext();
RedisTemplate<String, String> redisTemplate = (StringRedisTemplate) context
.getBean("redisTemplate");
redisTemplate.setKeySerializer(new StringRedisSerializer());
logger.info(redisTemplate.getKeySerializer().getClass().getName()+"第二");
Boolean flag = redisTemplate.opsForValue().setIfAbsent(key, value);
logger.info("获取到的flag为:"+flag);
logger.info("key的过期时间为"+redisTemplate.getExpire(key));
if ((flag || redisTemplate.getExpire(key) == -) && interval > ) {
logger.info("重新设置key的有效期为:"+key+interval);
redisTemplate.expire(key, interval, TimeUnit.SECONDS);
}
return flag;
}

【问题集】redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range的更多相关文章

  1. redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

    使用哨兵模式连接redis连接池时,遇到错误: Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sen ...

  2. redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index

    添加redis配置文件, 启动后,调用报错  redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index ERR i ...

  3. 【异常】redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'

    在spring中 针对 RedisTemplate类: private RedisTemplate<String, String> template; 当调用下面方法 template.o ...

  4. 阿里云 Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR invalid password

    如果你是买的阿里云的redis服务的话,不要被这个ERR invalid password所迷惑了. 你应该去检查一下你买的服务有没有设置白名单. 像mysql和mongodb的服务如果连不上的话也可 ...

  5. ERR Unsupported CONFIG parameter: notify-keyspace-events; nested exception is redis.clients.jedis.exceptions.JedisDataException

    异常信息 时间:2017-04-05 15:53:57,361 - 级别:[ WARN] - 消息: [other] The web application [ROOT] appears to hav ...

  6. redis.clients.jedis.exceptions.JedisDataException :READONLY You can't write

    分布式直连同步调用测试时出现的错误:主从复制架构下,默认Slave是只读的,如果写入则会报错: redis.clients.jedis.exceptions.JedisDataException: R ...

  7. redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots

    最近在学习Redis ,在写test测试的时候碰到这个报错: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is c ...

  8. Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only slave.

    Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a rea ...

  9. [redis] redis.clients.jedis.exceptions.JedisDataException: MOVED 13102 127.0.0.1

    这个异常上网查了很久才知道原因: MOVED indicates that you're using Redis Cluster. ShardedJedis is not for Redis Clus ...

随机推荐

  1. C#基于RSA加密算法实现软件注册实战演练

    一.课程介绍 本次分享课程属于<C#高级编程实战技能开发宝典课程系列>中的一部分,阿笨后续会计划将实际项目中的一些比较实用的关于C#高级编程的技巧分享出来给大家进行学习,不断的收集.整理和 ...

  2. 在AngularJS中实现一个延迟加载的Directive

    所谓的延迟加载通常是:直到用户交互时才加载.如何实现延迟加载呢? 需要搞清楚三个方面: 1.html元素的哪个属性需要延迟加载?2.需要对数据源的哪个字段进行延迟加载?3.通过什么事件来触发延迟加载? ...

  3. Node.js Cheerio parser breaks UTF-8 encoding

    From: https://stackoverflow.com/questions/31574127/node-js-cheerio-parser-breaks-utf-8-encoding [问题] ...

  4. springMVC返回json数据时date类型数据被转成long类型

    在项目的过程中肯定会遇到ajax请求,但是再用的过程中会发现,在数据库中好好的时间类型数据:2017-05-04 17:52:24 在转json的时候,得到的就不是时间格式了 而是145245121这 ...

  5. Linux-文件描述符的本质及与文件指针的区别

    文章参考:文件描述符的本质.文件描述符和文件指针的区别.文件描述符fd和文件指针flip的理解 推荐:task_struct 和文件系统的关系 系统中文件相关表 右侧的表称为i节点表,在整个系统中只有 ...

  6. 自动化测试中CSS SELECTOR选择器的一些写法

    常见符号: #表示id .表示class >表示子元素,层级 一个空格也表示子元素,但是是所有的后代子元素,相当于xpath中的相对路径 #input 选择id为input的节点 .Volvo ...

  7. 10.2.翻译系列:使用Fluent API进行属性映射【EF 6 Code-First】

    原文链接:https://www.entityframeworktutorial.net/code-first/configure-property-mappings-using-fluent-api ...

  8. Atitit.pagging  翻页功能解决方案专题 与 目录大纲 v3 r44.docx

    Atitit.pagging  翻页功能解决方案专题 与 目录大纲 v3 r44.docx 1.1. 翻页的重要意义1 1.2. Dep废弃文档   paip.js翻页分页pageing组件.txt1 ...

  9. pattern-matching as an expression without a prior match -scala

    https://www.scala-lang.org/files/archive/spec/2.11/08-pattern-matching.html https://docs.scala-lang. ...

  10. ③NuPlayer播放框架之类NuPlayer源码分析

    [时间:2016-10] [状态:Open] [关键词:android,nuplayer,开源播放器,播放框架] 0 引言 差不多一个月了,继续分析AOSP的播放框架的源码.这次我们需要深入分析的是N ...