调用replaceAll() 方法修改为调用 replace() 方法

传给 replaceAll 的参数不是正则表达式, replaceAll 和 replace 效果是一样的, 且 replaceAll 由于会调用 ava.util.regex.Pattern.compile()方法, 导致性能消耗更大
pull/705/head
Night_mare 2021-12-03 16:14:58 +08:00 committed by GitHub
parent 77a77933f1
commit ced71dafb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ public class LimitAspect {
}
}
ImmutableList<Object> keys = ImmutableList.of(StringUtils.join(limit.prefix(), "_", key, "_", request.getRequestURI().replaceAll("/","_")));
ImmutableList<Object> keys = ImmutableList.of(StringUtils.join(limit.prefix(), "_", key, "_", request.getRequestURI().replace("/","_")));
String luaScript = buildLuaScript();
RedisScript<Number> redisScript = new DefaultRedisScript<>(luaScript, Number.class);