redlock 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/redlock/client.rb +1 -0
- data/lib/redlock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982a50bb024c832b7371866687c1cb22bfe46221
|
4
|
+
data.tar.gz: 63629b88159f7a268f4c6b898745870bf3580de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c02c1679c769f0020236541831e8127c99d316286d082e038ef859c6ec668a98aee60d5248ae2f678e53dd0c65fb619bb8be2d609f4a7160920cdd0f0ab2428
|
7
|
+
data.tar.gz: ba0dd7f8c2631dd8a6a0633cd2504827fcd678423c8a5d0a4acbee5007de9ba3b0752aba47aad16dfa383ba5c7d8d69f6a1a0e0e48f776277a6be24c623dfbbf
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Redlock - A ruby distributed lock using redis.
|
2
2
|
|
3
3
|
> Distributed locks are a very useful primitive in many environments where different processes require to operate with shared resources in a mutually exclusive way.
|
4
|
-
>
|
4
|
+
>
|
5
5
|
> There are a number of libraries and blog posts describing how to implement a DLM (Distributed Lock Manager) with Redis, but every library uses a different approach, and many use a simple approach with lower guarantees compared to what can be achieved with slightly more complex designs.
|
6
6
|
|
7
7
|
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)
|
@@ -61,7 +61,7 @@ end
|
|
61
61
|
|
62
62
|
## Run tests
|
63
63
|
|
64
|
-
Make sure you have at least
|
64
|
+
Make sure you have at least 1 redis instances up.
|
65
65
|
|
66
66
|
$ rspec
|
67
67
|
|
data/lib/redlock/client.rb
CHANGED
@@ -32,6 +32,7 @@ module Redlock
|
|
32
32
|
# Params:
|
33
33
|
# +resource+:: the resource (or key) string to be locked.
|
34
34
|
# +ttl+:: The time-to-live in ms for the lock.
|
35
|
+
# +block+:: an optional block that automatically unlocks the lock.
|
35
36
|
def lock(resource, ttl, &block)
|
36
37
|
lock_info = lock_instances(resource, ttl)
|
37
38
|
|
data/lib/redlock/version.rb
CHANGED