class Redis

def script(subcommand, *args)

Other tags:
    See: #evalsha -
    See: #eval -

Returns:
  • (String, Boolean, Array, ...) - depends on subcommand

Parameters:
  • args (Array) -- depends on subcommand
  • subcommand (String) -- e.g. `exists`, `flush`, `load`, `kill`

Other tags:
    Example: Kill a running script -
    Example: Flush the script registry -
    Example: Check if multiple scripts exist -
    Example: Check if a script exists -
    Example: Load a script -
def script(subcommand, *args)
  subcommand = subcommand.to_s.downcase
  if subcommand == "exists"
    synchronize do |client|
      arg = args.first
      client.call([:script, :exists, arg]) do |reply|
        reply = reply.map { |r| Boolify.call(r) }
        if arg.is_a?(Array)
          reply
        else
          reply.first
        end
      end
    end
  else
    synchronize do |client|
      client.call([:script, subcommand] + args)
    end
  end
end