提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.common.annotation; |
A |
2 |
|
|
3 |
import java.lang.annotation.Documented; |
|
4 |
import java.lang.annotation.ElementType; |
|
5 |
import java.lang.annotation.Retention; |
|
6 |
import java.lang.annotation.RetentionPolicy; |
|
7 |
import java.lang.annotation.Target; |
|
8 |
import com.jcdm.common.constant.CacheConstants; |
|
9 |
import com.jcdm.common.enums.LimitType; |
|
10 |
|
|
11 |
/** |
|
12 |
* 限流注解 |
|
13 |
* |
|
14 |
* @author jc |
|
15 |
*/ |
|
16 |
@Target(ElementType.METHOD) |
|
17 |
@Retention(RetentionPolicy.RUNTIME) |
|
18 |
@Documented |
|
19 |
public @interface RateLimiter |
|
20 |
{ |
|
21 |
/** |
|
22 |
* 限流key |
|
23 |
*/ |
|
24 |
public String key() default CacheConstants.RATE_LIMIT_KEY; |
|
25 |
|
|
26 |
/** |
|
27 |
* 限流时间,单位秒 |
|
28 |
*/ |
|
29 |
public int time() default 60; |
|
30 |
|
|
31 |
/** |
|
32 |
* 限流次数 |
|
33 |
*/ |
|
34 |
public int count() default 100; |
|
35 |
|
|
36 |
/** |
|
37 |
* 限流类型 |
|
38 |
*/ |
|
39 |
public LimitType limitType() default LimitType.DEFAULT; |
|
40 |
} |