Skip to content

Commit

Permalink
Merge pull request #11 from hobodave/stop-using-redis-client-directly
Browse files Browse the repository at this point in the history
Redis::Client#call to Redis#set and Redis#eval
  • Loading branch information
leandromoreira committed Apr 21, 2015
2 parents 9880951 + 182f103 commit 3a5fe07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/redlock/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def initialize(connection)
end

def lock(resource, val, ttl)
@redis.client.call([:set, resource, val, 'NX', 'PX', ttl])
@redis.set(resource, val, nx: true, px: ttl)
end

def unlock(resource, val)
@redis.client.call([:eval, UNLOCK_SCRIPT, 1, resource, val])
@redis.eval(UNLOCK_SCRIPT, [resource], [val])
rescue
# Nothing to do, unlocking is just a best-effort attempt.
end
Expand Down
2 changes: 1 addition & 1 deletion lib/redlock/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Redlock
VERSION = "0.1.0"
VERSION = "0.1.1"
end

0 comments on commit 3a5fe07

Please sign in to comment.