Upstash Documentation

FUNCTION LOAD

Load a library to Redis.
1 min read

Redis functions act as a superset of Lua scripts. Instead of sending the script content with every request (like EVAL), you load the script once as a "library" and call the functions it registers.

Note

Currently, LUA is the only supported engine.

The library source code must start with the #!lua name=<library_name> shebang. Inside the script, use redis.register_function to expose your functions.

The registered functions can be called with the FCALL command.

Arguments#

optionsObjectrequired#

The load options.

Show properties
codestringrequired#

The source code of the library.

replaceboolean#

Whether to overwrite the library if it already exists. If false and the library already exists, Redis will return an error.

Default: "false"

Response#