update 优化 限流注解 key 支持简单 spel 表达式

This commit is contained in:
疯狂的狮子Li
2023-04-03 13:22:07 +08:00
parent df38aad2b5
commit dffd5bf02a
2 changed files with 21 additions and 1 deletions

View File

@ -49,4 +49,16 @@ public class RedisRateLimiterController {
return R.ok("操作成功", value);
}
/**
* 测试请求IP限流(key基于参数获取)
* 同一IP请求受影响
*
* 简单变量获取 #变量 复杂表达式 #{#变量 != 1 ? 1 : 0}
*/
@RateLimiter(count = 2, time = 10, limitType = LimitType.IP, key = "#value")
@GetMapping("/testObj")
public R<String> testObj(String value) {
return R.ok("操作成功", value);
}
}