class Redis

def watch(*keys)

Other tags:
    See: #multi -
    See: #unwatch -

Returns:
  • (String) - if not using a block, returns `OK`
  • (Object) - if using a block, returns the return value of the block

Parameters:
  • keys (String, Array) -- one or more keys to watch

Other tags:
    Example: Without a block -
    Example: With a block -
def watch(*keys)
  synchronize do |client|
    client.call [:watch, *keys]
    if block_given?
      begin
        yield
      rescue ConnectionError
        raise
      rescue StandardError
        unwatch
        raise
      end
    end
  end
end