redistempalate的超时设置的操作更新

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);

原文链接:https://blog.csdn.net/yuxin6866/article/details/52401590

posted on 2019-09-25 16:31  木西-Muxy  阅读(1514)  评论(0)    收藏  举报

导航