package com.caimei.annotation; import java.lang.annotation.*; /** * 自定义幂等注解 * * @author : Charles * @date : 2021/2/26 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Idempotent { /** * 前缀属性,作为redis缓存Key的一部分。 */ String prefix() default "idempotent_"; /** * 需要的参数名数组 */ String[] keys(); /** * 幂等过期时间(秒),即:在此时间段内,对API进行幂等处理。 */ int expire() default 3; }