lib/redis-lock.rb
# Only actually deletes it if we own it.
# There may be strange cases where we fail to delete it, in which case expiration will solve the problem.
Only actually deletes it if we own it.
There may be strange cases where we fail to delete it, in which case expiration will solve the problem.
Only actually deletes it if we own it . There may be strange cases where we fail to delete it in which case expiration will solve the problem .
def release_lock( my_owner = oval )
      with_watch( okey, xkey ) do
        owner = redis.get( okey )
        if owner == my_owner then
          redis.multi do |multi|
            multi.del( okey )
            multi.del( xkey )
          end
        end
      end
    end
def release_lock ( my_owner = oval ) with_watch ( okey , xkey ) do owner = redis . get ( okey ) if owner == my_owner then redis . multi do | multi | multi . del ( okey ) multi . del ( xkey ) end end end end
Only actually deletes it if we own it.
Only actually deletes it if we own it .
# Use my_owner = oval to make testing easier.
my_owner
oval