README.md in redlock-1.3.2 vs README.md in redlock-2.0.0
- old
+ new
@@ -13,11 +13,11 @@
This is an implementation of a proposed [distributed lock algorithm with Redis](http://redis.io/topics/distlock). It started as a fork from [antirez implementation.](https://github.com/antirez/redlock-rb)
## Compatibility
-Redlock works with Redis versions 2.6 or later.
+Redlock works with Redis versions 6.0 or later.
## Installation
Add this line to your application's Gemfile:
@@ -149,11 +149,11 @@
lock_manager.get_remaining_ttl_for_lock(lock_info)
#=> 986
lock_manager.unlock(lock_info)
lock_manager.get_remaining_ttl_for_lock(lock_info)
-#=> nil
+#=> nil
```
Use `get_remaining_ttl_for_resource` if you do not hold a lock, but want to know the remaining TTL on a locked resource:
```ruby
# Some part of the code
@@ -162,24 +162,24 @@
# Some other part of the code
lock_manager.locked?(resource)
#=> true
lock_manager.get_remaining_ttl_for_resource(resource)
-#=> 1975
+#=> 1975
# Sometime later
lock_manager.locked?(resource)
#=> false
lock_manager.get_remaining_ttl_for_resource(resource)
-#=> nil
+#=> nil
```
## Redis client configuration
`Redlock::Client` expects URLs or Redis objects on initialization. Redis objects should be used for configuring the connection in more detail, i.e. setting username and password.
```ruby
-servers = [ 'redis://localhost:6379', Redis.new(:url => 'redis://someotherhost:6379') ]
+servers = [ 'redis://localhost:6379', RedisClient.new(:url => 'redis://someotherhost:6379') ]
redlock = Redlock::Client.new(servers)
```
Redlock works seamlessly with [redis sentinel](http://redis.io/topics/sentinel), which is supported in redis 3.2+.