redisTemplate超时设置
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);
还没有评论,来说两句吧...