Learn R Programming

rredis (version 1.6.9)

redisEval: Evaluate a Lua script in the Redis server.

Description

Evaluate a Lua script in the Redis server.

Usage

redisEval(script, keys = vector("list",0), SHA = FALSE, ...)

Arguments

script
A Redis server-side Lua script (character).
keys
An optional list of script key arguments.
SHA
If TRUE, the script is a SHA1-encoded string, otherwise plan text.
...
Optional list of script arguments.

Value

  • "OK" is returned on success. Errors are displayed if the script fails.

References

http://redis.io/commands

Examples

Run this code
redisConnect()
redisEval("return redis.call('set','foo','bar')")

# Supply a key argument to the script
redisEval("return redis.call('set',KEYS[1],'bar')", "foo")

# Supply a key and other arguments to the script
redisEval("return redis.call('set',KEYS[1],ARGV[1])", "foo", pi)

Run the code above in your browser using DataLab