mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-10-01 10:58:40 +08:00
refactor(idempotent): 重构幂等模块并支持 Redisson 缓存
This commit is contained in:
@@ -20,27 +20,39 @@ import java.lang.annotation.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 定义幂等注解
|
||||
* 幂等注解
|
||||
*
|
||||
* @version 1.0
|
||||
* @Author loach
|
||||
* @Date 2025-03-07 19:26
|
||||
* @Package top.continew.starter.idempotent.annotation.Idempotent
|
||||
* @author loach
|
||||
* @author Charles7c
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Documented
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Idempotent {
|
||||
|
||||
// 幂等key前缀
|
||||
String prefix() default "idempotent:";
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
// key的过期时间
|
||||
long timeout() default 0;
|
||||
/**
|
||||
* 键(支持 Spring EL 表达式)
|
||||
*/
|
||||
String key() default "";
|
||||
|
||||
// 时间单位
|
||||
TimeUnit timeUnit() default TimeUnit.SECONDS;
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
int timeout() default 1;
|
||||
|
||||
// 失败时的提示信息
|
||||
/**
|
||||
* 时间单位(默认:毫秒)
|
||||
*/
|
||||
TimeUnit unit() default TimeUnit.MILLISECONDS;
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
String message() default "请勿重复操作";
|
||||
}
|
Reference in New Issue
Block a user