注解
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface XXXCache{
long timeout() default 10 * 60 * 1000L;
String deadline() default "";
}
通知
@Around(value = "@annotation(com.xxx.xxx.annotation.XXXCache) and @annotation(cache)",
argNames = "thisJoinPoint,cache")
public Object record(ProceedingJoinPoint thisJoinPoint, Cache cache);
使用
@XXXCache(timeout = 5 * 1000)
public double getDemo(){}