Class RedisLockProvider

  • All Implemented Interfaces:
    LockProvider

    public class RedisLockProvider
    extends Object
    implements LockProvider
    Uses Redis's `SET resource-name anystring NX PX max-lock-ms-time` as locking mechanism. See https://redis.io/commands/set
    • Constructor Detail

      • RedisLockProvider

        public RedisLockProvider​(@NotNull
                                 @NotNull org.springframework.data.redis.connection.RedisConnectionFactory redisConn)
      • RedisLockProvider

        public RedisLockProvider​(@NotNull
                                 @NotNull org.springframework.data.redis.connection.RedisConnectionFactory redisConn,
                                 @NotNull
                                 @NotNull String environment)
        Creates RedisLockProvider
        Parameters:
        redisConn - RedisConnectionFactory
        environment - environment is part of the key and thus makes sure there is not key conflict between multiple ShedLock instances running on the same Redis