唐耀东
2021-12-09 eeeddf0836a5a5aa03a3342d34318c7202313e93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.ruoyi.common.annotation;
 
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.enums.LimitType;
 
import java.lang.annotation.*;
 
/**
 * 限流注解
 *
 * @author Lion Li
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter {
    /**
     * 限流key
     */
    String key() default Constants.RATE_LIMIT_KEY;
 
    /**
     * 限流时间,单位秒
     */
    int time() default 60;
 
    /**
     * 限流次数
     */
    int count() default 100;
 
    /**
     * 限流类型
     */
    LimitType limitType() default LimitType.DEFAULT;
}