【问题集】redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range
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的更多相关文章
- 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 ...
- redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index
添加redis配置文件, 启动后,调用报错 redis.clients.jedis.exceptions.JedisDataException: ERR invalid DB index ERR i ...
- 【异常】redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'
在spring中 针对 RedisTemplate类: private RedisTemplate<String, String> template; 当调用下面方法 template.o ...
- 阿里云 Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR invalid password
如果你是买的阿里云的redis服务的话,不要被这个ERR invalid password所迷惑了. 你应该去检查一下你买的服务有没有设置白名单. 像mysql和mongodb的服务如果连不上的话也可 ...
- 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 ...
- redis.clients.jedis.exceptions.JedisDataException :READONLY You can't write
分布式直连同步调用测试时出现的错误:主从复制架构下,默认Slave是只读的,如果写入则会报错: redis.clients.jedis.exceptions.JedisDataException: R ...
- redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots
最近在学习Redis ,在写test测试的时候碰到这个报错: redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is c ...
- 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 ...
- [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 ...
随机推荐
- php实现查询上传文件进度
参考:http://www.ultramegatech.com/2010/10/create-an-upload-progress-bar-with-php-and-jquery/ 11OCT/108 ...
- arcgis pro行列转换
行转列 列转行
- 计算请假天数JavaScript方法
前言 最近,有这么个需求,给用户做个请假审批系统,要输入请假开始时间和结束时间,同时计算出请假天数,如果年假数量不够提示不能提交,如果年假数量够的话,就走审批工作流,审批通过以后,自动在年假上减去这个 ...
- 【Qt5】Windows下配置程序的产品、公司、版权、版本号等详细信息
在工程的pro文件中加入下面的配置 # 配置图标(仅Windows有效)# 本程序使用两个图标,这样其快捷方式可以有更多选择,也可以给关联文件提供图标选择RC_ICONS += icon1.ico \ ...
- 监控命令之tsar
1.1 tsar是什么? tsar是淘宝自己开发的一个采集工具(类似于sar工具),主要用来收集服务器的系统信息(如cpu,io,mem,tcp等),以及应用数据(如squid haproxy ngi ...
- JAVA通过oshi获取系统和硬件信息
一.引入jar包 本项目主要使用第开源jar包:https://github.com/oshi/oshi <dependency> <groupId>junit</gro ...
- mysql和redis的区别
一..redis和mysql的区别总结 (1)类型上 从类型上来说,mysql是关系型数据库,redis是缓存数据库 (2)作用上 mysql用于持久化的存储数据到硬盘, ...
- iPhone X 适配 ( iOS 11适配 )
总结: 1.状态栏高度发生变化,解决方案:布局的时候这个高度不要写死,通过方法获取高度. 2.导航栏的视图层级结构发生变化而导致 UI(titleView.UIBarButtonItem) 问题. 3 ...
- 利用jsPDF有效减轻报表型应用服务器的IO负载
1.利用jsPDF在客户端浏览器上生成pdf文档 使用这种方法可以有效减轻服务器的压力,但是对于国际化,此库任然存在的问题:该库不支持unicode,生成中文文档会乱码,官方也有描述这个问题,详情请参 ...
- Spark2.3 HA集群的分布式安装
一.下载Spark安装包 1.从官网下载 http://spark.apache.org/downloads.html 2.从微软的镜像站下载 http://mirrors.hust.edu.cn/a ...