Module: Redis::Commands::Scripting
- Included in:
- Redis::Commands
- Defined in:
- lib/redis/commands/scripting.rb
Instance Method Summary collapse
-
#eval(*args) ⇒ Object
Evaluate Lua script.
-
#evalsha(*args) ⇒ Object
Evaluate Lua script by its SHA.
-
#fcall(*args) ⇒ Object
Invoke a Redis Function loaded with FUNCTION LOAD.
-
#fcall_ro(*args) ⇒ Object
Invoke a read-only Redis Function loaded with FUNCTION LOAD.
-
#function(subcommand, *args, **options) ⇒ String, ...
Manage Redis Functions libraries.
-
#script(subcommand, *args) ⇒ String, ...
Control remote script registry.
Instance Method Details
#eval(*args) ⇒ Object
Evaluate Lua script.
71 72 73 |
# File 'lib/redis/commands/scripting.rb', line 71 def eval(*args) _eval(:eval, args) end |
#evalsha(*args) ⇒ Object
Evaluate Lua script by its SHA.
96 97 98 |
# File 'lib/redis/commands/scripting.rb', line 96 def evalsha(*args) _eval(:evalsha, args) end |
#fcall(*args) ⇒ Object
Invoke a Redis Function loaded with FUNCTION LOAD.
184 185 186 |
# File 'lib/redis/commands/scripting.rb', line 184 def fcall(*args) _eval(:fcall, args) end |
#fcall_ro(*args) ⇒ Object
Invoke a read-only Redis Function loaded with FUNCTION LOAD.
The function must have been registered with the no-writes flag.
205 206 207 |
# File 'lib/redis/commands/scripting.rb', line 205 def fcall_ro(*args) _eval(:fcall_ro, args) end |
#function(subcommand, *args, **options) ⇒ String, ...
Manage Redis Functions libraries.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/redis/commands/scripting.rb', line 139 def function(subcommand, *args, **) subcommand = subcommand.to_s.downcase case subcommand when "load" command = %i[function load] command << "REPLACE" if [:replace] send_command(command + args) when "list" command = %i[function list] + args command << "LIBRARYNAME" << [:libraryname] if [:libraryname] command << "WITHCODE" if [:withcode] send_command(command, &HashifyFunctionList) when "restore" command = %i[function restore] + args command << [:policy].to_s.upcase if [:policy] send_command(command) when "stats" send_command(%i[function stats], &HashifyFunctionStats) else send_command([:function, subcommand] + args) end end |
#script(subcommand, *args) ⇒ String, ...
Control remote script registry.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# 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 |