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
