README.md in suo-0.3.0 vs README.md in suo-0.3.1
- old
+ new
@@ -32,11 +32,11 @@
end
# The resources argument is the number of resources the semaphore will allow to lock (defaulting to one - a mutex)
suo = Suo::Client::Memcached.new("bar_resource", client: some_dalli_client, resources: 2)
-Thread.new { suo.lock{ puts "One"; sleep 2 } }
+Thread.new { suo.lock { puts "One"; sleep 2 } }
Thread.new { suo.lock { puts "Two"; sleep 2 } }
Thread.new { suo.lock { puts "Three" } }
# will print "One" "Two", but not "Three", as there are only 2 resources
@@ -44,11 +44,11 @@
suo = Suo::Client::Memcached.new("protected_key", client: some_dalli_client, acquisition_timeout: 1) # in seconds
# manually locking/unlocking
# the return value from lock without a block is a unique token valid only for the current lock
# which must be unlocked manually
-token = suo
+token = suo.lock
foo.baz!
suo.unlock(token)
# custom stale lock expiration (cleaning of dead locks)
suo = Suo::Client::Redis.new("other_key", client: some_redis_client, stale_lock_expiration: 60*5)
@@ -75,10 +75,10 @@
## TODO
- more race condition tests
## History
-View the [changelog](https://github.com/nickelser/suo/blob/master/CHANGELOG.md)
+View the [changelog](https://github.com/nickelser/suo/blob/master/CHANGELOG.md).
## Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help: