疯狂的狮子li
2021-11-29 42295ef2ac0a5e78674cf24b62d6834138f0ffdc
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
@@ -22,37 +22,37 @@
@RequestMapping("/demo/rateLimiter")
public class RedisRateLimiterController {
   /**
    * 测试全局限流
    * 全局影响
    */
   @ApiOperation("测试全局限流")
   @RateLimiter(count = 2, time = 10)
   @GetMapping("/test")
   public  AjaxResult<String> test(String value){
      return AjaxResult.success("操作成功",value);
   }
    /**
     * 测试全局限流
     * 全局影响
     */
    @ApiOperation("测试全局限流")
    @RateLimiter(count = 2, time = 10)
    @GetMapping("/test")
    public AjaxResult<String> test(String value) {
        return AjaxResult.success("操作成功", value);
    }
   /**
    * 测试请求IP限流
    * 同一IP请求受影响
    */
   @ApiOperation("测试请求IP限流")
   @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
   @GetMapping("/testip")
   public  AjaxResult<String> testip(String value){
      return AjaxResult.success("操作成功",value);
   }
    /**
     * 测试请求IP限流
     * 同一IP请求受影响
     */
    @ApiOperation("测试请求IP限流")
    @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
    @GetMapping("/testip")
    public AjaxResult<String> testip(String value) {
        return AjaxResult.success("操作成功", value);
    }
   /**
    * 测试集群实例限流
    * 启动两个后端服务互不影响
    */
   @ApiOperation("测试集群实例限流")
   @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
   @GetMapping("/testcluster")
   public  AjaxResult<String> testcluster(String value){
      return AjaxResult.success("操作成功",value);
   }
    /**
     * 测试集群实例限流
     * 启动两个后端服务互不影响
     */
    @ApiOperation("测试集群实例限流")
    @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
    @GetMapping("/testcluster")
    public AjaxResult<String> testcluster(String value) {
        return AjaxResult.success("操作成功", value);
    }
}