package com.caimei.annotation; import java.lang.annotation.*; /** * 自定义统计注解 * * @author : Charles * @date : 2021/12/29 */ // @Target 指定注解作用的地方:方法,变量,类 @Target(ElementType.METHOD) // @Retention 生命周期 @Retention(RetentionPolicy.RUNTIME) // @Documented 是否能随着被定义的java文件生成到JavaDoc文档当中 (非必填) @Documented public @interface Statistics { /** * 前缀属性,作为redis缓存Key的一部分。 */ String prefix() default "statistics_"; /** * 需要的参数名 */ String field(); /** * 过期时间(秒),默认两天 60*60*24*2 = 172800 */ int expire() default 172800; }