Skip to content

Commit

Permalink
⚡ 修改redis的key名前缀,使用类名+方法名
Browse files Browse the repository at this point in the history
  • Loading branch information
xkcoding committed Sep 30, 2019
1 parent bb84c3a commit 27e2742
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public Object pointcut(ProceedingJoinPoint point) throws Throwable {
RateLimiter rateLimiter = AnnotationUtils.findAnnotation(method, RateLimiter.class);
if (rateLimiter != null) {
String key = rateLimiter.key();
// 默认用方法名做限流的 key 前缀
// 默认用类名+方法名做限流的 key 前缀
if (StrUtil.isBlank(key)) {
key = method.getName();
key = method.getDeclaringClass().getName()+StrUtil.DOT+method.getName();
}
// 最终限流的 key 为 前缀 + IP地址
// TODO: 此时需要考虑局域网多用户访问的情况,因此 key 后续需要加上方法参数更加合理
Expand Down

0 comments on commit 27e2742

Please sign in to comment.