RedisLock.java 541 B

123456789101112131415161718192021222324252627
  1. package com.ruoyi.common.annotation;
  2. import java.lang.annotation.ElementType;
  3. import java.lang.annotation.Retention;
  4. import java.lang.annotation.RetentionPolicy;
  5. import java.lang.annotation.Target;
  6. /**
  7. * 分布式锁(注解模式,不推荐使用,最好用锁的工具类)
  8. */
  9. @Target({ElementType.METHOD})
  10. @Retention(RetentionPolicy.RUNTIME)
  11. public @interface RedisLock {
  12. /**
  13. * 锁过期时间
  14. * @return
  15. */
  16. int expireTime() default 30;//30秒
  17. /**
  18. * 锁key值
  19. * @return
  20. */
  21. String key() default "redisLockKey";
  22. }