Scripting
Lua scripts and function libraries (EVAL, EVALSHA, SCRIPT, FUNCTION, FCALL), in the Lua and Full builds of KiviDB.
EVAL: Runs a Lua script on the server, as one step: no other client's command starts while it runs.EVAL_RO: EVAL for a script that only reads: a command in it that writes fails.EVALSHA: Runs a script the server already has, named by its SHA1 digest, as SCRIPT LOAD returns it, or as a previous EVAL cached it.EVALSHA_RO: Runs a script the server already has, named by its SHA1 digest, as EVALSHA does, on the condition that the script only reads: a command in it that writes fails, and the script stops with that error.FCALL: Calls a function of a library loaded with FUNCTION LOAD.FCALL_RO: FCALL for a function registered with the no-writes flag; any other is refused.FUNCTION: Manages libraries of functions, which FCALL calls.FUNCTION DELETE: Deletes a library of functions, and with it every function the library registered.FUNCTION DUMP: Returns every library of functions as one binary payload, which FUNCTION RESTORE loads, on this server or another KiviDB server.FUNCTION FLUSH: Deletes every library of functions, and so every function: FCALL of any of them then fails with ERR Function not found.FUNCTION HELP: Lists the FUNCTION subcommands, each with its arguments and a line on what it does, as the server knows them.FUNCTION KILL: Stops the function that is running, called with FCALL or FCALL_RO, if it has not written anything yet.FUNCTION LIST: Returns every library, or those whose names match LIBRARYNAME pattern, with its functions, each with its description and flags.FUNCTION LOAD: Loads a library of functions.FUNCTION RESTORE: Loads a payload from FUNCTION DUMP.FUNCTION STATS: Returns the function running, if any (its name, command and duration so far), and the number of libraries and functions.
SCRIPT: SCRIPT is a container: its subcommands manage the cache of Lua scripts that EVAL and SCRIPT LOAD fill and EVALSHA runs from, and the script running now.SCRIPT DEBUG: Accepted for compatibility with Redis, and replies OK, but does nothing: KiviDB has no Lua debugger.SCRIPT EXISTS: Tells, for each SHA1 digest given, whether the server has that script in its cache, so that EVALSHA can run it.SCRIPT FLUSH: Empties the script cache: every script loaded with SCRIPT LOAD or sent with EVAL is forgotten, and EVALSHA of any of them gets NOSCRIPT until the script is sent again.SCRIPT HELP: Lists the SCRIPT subcommands, with a line or two on what each does, as Redis does.SCRIPT KILL: Stops the script running, if it has not written anything.SCRIPT LOAD: Puts a script in the server's cache, without running it, and returns its SHA1 digest.