Statistics.java 723 B

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