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);
--------------------- 
作者:厚积_薄发 
来源:CSDN 
原文:https://blog.csdn.net/yuxin6866/article/details/52401590 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/zgp18963349823/article/details/85680290