lib/redis/lock.rb in redis-objects-0.6.1 vs lib/redis/lock.rb in redis-objects-0.7.0
- old
+ new
@@ -9,15 +9,15 @@
# class to define a lock.
#
class Lock < BaseObject
class LockTimeout < StandardError; end #:nodoc:
- attr_reader :key, :options, :redis
+ attr_reader :key, :options
def initialize(key, *args)
super(key, *args)
@options[:timeout] ||= 5
@options[:init] = false if @options[:init].nil? # default :init to false
- @redis.setnx(key, @options[:start]) unless @options[:start] == 0 || @options[:init] === false
+ redis.setnx(key, @options[:start]) unless @options[:start] == 0 || @options[:init] === false
end
# Clear the lock. Should only be needed if there's a server crash
# or some other event that gets locks in a stuck state.
def clear