redisTemplate超时设置

来源:互联网 发布:js监听手机端软键盘 编辑:程序博客网 时间:2024/06/18 15:04

redistempalate的超时设置时,一定要每次用set写入时,更新超时,不然默认会失效的。

例如:

int tempTime = this.redisTemplate.getExpire("max").intValue();
tempCount = this.redisTemplate.opsForValue().get("max")-1;
this.redisTemplate.opsForValue().set("max", tempCount);
this.redisTemplate.expire("max",tempTime,TimeUnit.SECONDS);


0 0
原创粉丝点击