lib/redis_mutex.rb
#
# Options
#
# :block  => Specify in seconds how long you want to wait for the lock to be released. Speficy 0
#            if you need non-blocking sematics and return false immediately. (default: 1)
# :sleep  => Specify in seconds how long the polling interval should be when :block is given.
#            It is recommended that you do NOT go below 0.01. (default: 0.1)
# :expire => Specify in seconds when the lock should forcibly be removed when something went wrong
#            with the one who held the lock. (default: 10)
#
Options
:block  => Specify in seconds how long you want to wait for the lock to be released. Speficy 0
if you need non-blocking sematics and return false immediately. (default: 1)
:sleep  => Specify in seconds how long the polling interval should be when :block is given.
It is recommended that you do NOT go below 0.01. (default: 0.1)
:expire => Specify in seconds when the lock should forcibly be removed when something went wrong
with the one who held the lock.
Options : block = > Specify in seconds how long you want to wait for the lock to be released . Speficy 0 if you need non - blocking sematics and return false immediately . ( default : 1 ) : sleep = > Specify in seconds how long the polling interval should be when : block is given . It is recommended that you do NOT go below 0 . 01 . ( default : 0 . 1 ) : expire = > Specify in seconds when the lock should forcibly be removed when something went wrong with the one who held the lock .
def unlock(force = false)
    if has_lock? or force
      !!del
    else
      false
    end
  end
def unlock ( force = false ) if has_lock? or force ! ! del else false end end
Options
:block  => Specify in seconds how long you want to wait for the lock to be released.
Options : block = > Specify in seconds how long you want to wait for the lock to be released .
# Since it's possible that the operations in the critical section took a long time, # we can't just simply release the lock. The unlock method checks if @expires_at # remains the same, and do not release when the lock timestamp was overwritten. # Redis#del with a single key returns '1' or nil
force