【问题集】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 ...
随机推荐
- JVM Debugger Memory View for IntelliJ IDEA
Posted on August 19, 2016 by Andrey Cheptsov Every day we try to find new ways to improve developer ...
- OUI启动时的小错误PRVF-0002
[oracle@bys3 database]$ Starting Oracle Universal Installer... Checking Temp space: must be greater ...
- 原创:vsphere概念深入系列四:Nic Teaming若干问题
参考文档:http://www.hyper-v.nu/archives/marcve/2013/01/lbfo-hyper-v-switch-qos-and-actual-performance-pa ...
- JS 全屏代码
// 推断各种浏览器,找到正确的方法 function launchFullscreen(element) { if(element.requestFullscreen) { element.requ ...
- 视音频数据处理入门:AAC音频码流解析
===================================================== 视音频数据处理入门系列文章: 视音频数据处理入门:RGB.YUV像素数据处理 视音频数据处理 ...
- nginx与apache的参考配置
nginx与apache是两大最主流的服务器,功能强大,但配置起来也比较麻烦,对于初学者来讲可能有些地方并不完全清楚其作用,这里搜集了一些配置的作用及其使用方法.其中nginx提供了推荐配置,而apa ...
- 设置Nginx以列表方式显示网站内容
服务器目录内容: 访问该页面时,将所有文件和目录按列表方式显示 nginx配置文件
- 游戏编程精粹学习 - 使用Bloom过滤来提高计算性能(BloomFilter)
原文在<游戏编程精粹2>的1.2中,BloomFilter是一种可以快速检测是否存在集合包含关系的数据结构,但有一定的误识别率. 该结构的优点 判断包含关系时效率较高,粗略测试了下比Lis ...
- python学习之struct模块
class struct.Struct(format) 返回一个struct对象(结构体,参考C). 该对象可以根据格式化字符串的格式来读写二进制数据. 第一个参数(格式化字符串)可以指定字节的顺序. ...
- IOS开发之Core Location
IOS 支持三种检测当前位置的方式:手机基站.Wi-Fi.和GPS,其中GPS是经度最高的,同时也是最耗费手机电量的.一般情况下在室内是无法通过GPS获 取位置信息的,通过Wi-Fi获取位置的原理是通 ...