Load and Evaluate Scripts by SHA

script_load.evalsha(named_scripts, redis = hi(), ...)

Arguments

named_scripts

Named list of Lua scripts

redis

High-level Redis interface

...

Arguments passed on to scripts

x

Redis high-level interface

Value

SHA evaluate function accepting script name, key vector and argument vector in that order; the name becomes the Lua script SHA by look-up

Details

Redux decodes a Redis reply as a raw vector if the first two characters match X or B followed by new-line. Raw vector replies then answer if the remaining bytes contain at least one null, a zero byte. See the implementation of the C function is_raw_string in the redux package for more details.

Examples

if (FALSE) {
evalsha <- script_load.evalsha(list(version = "return _VERSION"))
evalsha("version")
#> [1] "Lua 5.1"
script_load.evalsha(list(lua = 'return "X\\n\\0"..ARGV[1]'))("lua",, "hello")
#> [1] 58 0a 00 68 65 6c 6c 6f
}