Module: Redis::Commands::Scripting
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/redis/commands/scripting.rb |
Instance Method Summary
-
#eval(*args) ⇒ Object
Evaluate Lua script.
-
#evalsha(*args) ⇒ Object
Evaluate Lua script by its SHA.
-
#script(subcommand, *args) ⇒ String, ...
Control remote script registry.
- #_eval(cmd, args) private
Instance Method Details
#_eval(cmd, args) (private)
[ GitHub ]# File 'lib/redis/commands/scripting.rb', line 102
def _eval(cmd, args) script = args.shift = args.pop if args.last.is_a?(Hash) ||= {} keys = args.shift || [:keys] || [] argv = args.shift || [:argv] || [] send_command([cmd, script, keys.length] + keys + argv) end
#eval(*args) ⇒ Object
Evaluate Lua script.
# File 'lib/redis/commands/scripting.rb', line 71
def eval(*args) _eval(:eval, args) end
#evalsha(*args) ⇒ Object
Evaluate Lua script by its SHA.
# File 'lib/redis/commands/scripting.rb', line 96
def evalsha(*args) _eval(:evalsha, args) end
#script(subcommand, *args) ⇒ String
, ...
Control remote script registry.
# File 'lib/redis/commands/scripting.rb', line 30
def script(subcommand, *args) subcommand = subcommand.to_s.downcase if subcommand == "exists" arg = args.first send_command([:script, :exists, arg]) do |reply| reply = reply.map { |r| Boolify.call(r) } if arg.is_a?(Array) reply else reply.first end end else send_command([:script, subcommand] + args) end end