Class RedisLockProvider

java.lang.Object
net.javacrumbs.shedlock.provider.redis.spring.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 Details

    • RedisLockProvider

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

      public RedisLockProvider​(org.springframework.data.redis.connection.RedisConnectionFactory redisConn, 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
    • RedisLockProvider

      public RedisLockProvider​(org.springframework.data.redis.connection.RedisConnectionFactory redisConn, String environment, String keyPrefix)
      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
      keyPrefix - prefix of the key in Redis.
    • RedisLockProvider

      public RedisLockProvider​(org.springframework.data.redis.core.StringRedisTemplate redisTemplate, String environment, String keyPrefix)
      Create RedisLockProvider
      Parameters:
      redisTemplate - StringRedisTemplate
      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
      keyPrefix - prefix of the key in Redis.
  • Method Details