mirror of
https://github.com/dkam/suo.git
synced 2025-01-29 07:42:43 +00:00
release 0.2.0
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
## 0.2.0
|
||||||
|
|
||||||
|
- Refactor class methods into instance methods to simplify implementation.
|
||||||
|
- Increase thread safety with Memcached implementation.
|
||||||
|
|
||||||
## 0.1.3
|
## 0.1.3
|
||||||
|
|
||||||
- Properly throw Suo::LockClientError when the connection itself fails (Memcache server not reachable, etc.)
|
- Properly throw Suo::LockClientError when the connection itself fails (Memcache server not reachable, etc.)
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -31,12 +31,22 @@ suo.lock("some_key") do
|
|||||||
@puppies.pet!
|
@puppies.pet!
|
||||||
end
|
end
|
||||||
|
|
||||||
2.times do
|
Thread.new { suo.lock("other_key", 2) { puts "One"; sleep 2 } }
|
||||||
Thread.new do
|
Thread.new { suo.lock("other_key", 2) { puts "Two"; sleep 2 } }
|
||||||
# second argument is the number of resources - so this will run twice
|
Thread.new { suo.lock("other_key", 2) { puts "Three" } }
|
||||||
suo.lock("other_key", 2, timeout: 0.5) { puts "Will run twice!" }
|
|
||||||
end
|
# will print "One" "Two", but not "Three", as there are only 2 resources
|
||||||
end
|
|
||||||
|
# custom acquisition timeouts (time to acquire)
|
||||||
|
suo = Suo::Client::Memcached.new(client: some_dalli_client, acquisition_timeout: 1) # in seconds
|
||||||
|
|
||||||
|
# manually locking/unlocking
|
||||||
|
suo.lock("a_key")
|
||||||
|
foo.baz!
|
||||||
|
suo.unlock("a_key")
|
||||||
|
|
||||||
|
# custom stale lock cleanup (cleaning of dead clients)
|
||||||
|
suo = Suo::Client::Redis.new(client: some_redis_client, stale_lock_expiration: 60*5)
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module Suo
|
module Suo
|
||||||
VERSION = "0.1.3"
|
VERSION = "0.2.0"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user