You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
689 B
37 lines
689 B
package com.dc.common.annotation;
|
|
|
|
import com.dc.common.constant.CacheConstants;
|
|
import com.dc.common.enums.LimitType;
|
|
|
|
import java.lang.annotation.*;
|
|
|
|
/**
|
|
* 限流注解
|
|
*
|
|
* @author win
|
|
*/
|
|
@Target(ElementType.METHOD)
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
@Documented
|
|
public @interface RateLimiter
|
|
{
|
|
/**
|
|
* 限流key
|
|
*/
|
|
public String key() default CacheConstants.RATE_LIMIT_KEY;
|
|
|
|
/**
|
|
* 限流时间,单位秒
|
|
*/
|
|
public int time() default 60;
|
|
|
|
/**
|
|
* 限流次数
|
|
*/
|
|
public int count() default 100;
|
|
|
|
/**
|
|
* 限流类型
|
|
*/
|
|
public LimitType limitType() default LimitType.DEFAULT;
|
|
}
|
|
|