lib/redis/objects/locks.rb in redis-objects-0.2.3 vs lib/redis/objects/locks.rb in redis-objects-0.2.4

- old
+ new

@@ -14,11 +14,10 @@ module ClassMethods # Define a new lock. It will function like a model attribute, # so it can be used alongside ActiveRecord/DataMapper, etc. def lock(name, options={}) options[:timeout] ||= 5 # seconds - options[:init] = false if options[:init].nil? # default :init to false @redis_objects[name] = options.merge(:type => :lock) if options[:global] instance_eval <<-EndMethods def #{name}_lock(&block) @#{name} ||= Redis::Lock.new(field_key(:#{name}_lock, ''), redis, @redis_objects[:#{name}]) @@ -34,12 +33,9 @@ def #{name}_lock(&block) @#{name} ||= Redis::Lock.new(field_key(:#{name}_lock), redis, self.class.redis_objects[:#{name}]) end EndMethods end - - - end # Obtain a lock, and execute the block synchronously. Any other code # (on any server) will spin waiting for the lock up to the :timeout # that was specified when the lock was defined.