1
利用Redisson按天做限流,历史生成的限流key不会自动清除,这个如何处理,可以设置缓存过期时间吗?
// rate limit 100 times per day
String date = DateFormatUtils.format(new Date(), BaseConstants.DATE_FORMAT_LEAN);
RRateLimiter timesPerDayRateLimiter = redissonClient.getRateLimiter(String.format(RedisConstants.TOKEN_REFRESH_TIMES_PER_DAY_RATE_LIMIT, date, userId));
timesPerDayRateLimiter.trySetRate(RateType.OVERALL, tokenProperties.getTokenRefreshTimesPerDayRateLimit(), 1, RateIntervalUnit.DAYS);
该缓存历史会清除 {token:refresh:20201021:68155c4000eb4d79a3f9516bfc51f9c5}:value
该缓存历史未清除 token:refresh:20201021:68155c4000eb4d79a3f9516bfc51f9c5