Skip to content

Latest commit

 

History

History
115 lines (82 loc) · 2.22 KB

commands.md

File metadata and controls

115 lines (82 loc) · 2.22 KB

Commands

RG.FUNCTION LOAD

Load a new library to RedisGears.

RG.FUNCTION LOAD [UPGRADE] "<library code>"

Arguments

  • UPGRADE - an optional argument, instructs RedisGears to upgrade the function if its already exists.
  • library code - the library code

Return

An error, if the loading failed or "OK" if everything was done correctly.

Example

> RG.FUNCTION LOAD "#!js name=lib\n redis.register_function('foo', ()=>{return 'bar'})"
OK

RG.FUNCTION DEL

Delete a library from RedisGears.

RG.FUNCTION DEL "<library name>"

Arguments

  • UPGRADE - an optional argument, instructs RedisGears to upgrade the function if its already exists.
  • library name - the name of the library to delete

Return

An error, if the library does not exists or "OK" if the library was deleted successfully.

Example

> RG.FUNCTION DEL lib
OK

RG.FUNCTION LIST

List the functions with additional information about each function.

RG.FUNCTION LIST [WITHCODE] [VERBOSE] [v] [LIBRARY <library name>]

Arguments

  • WITHCODE - Show libraries code.
  • VERBOSE - Increase output verbosity (can be used mutiple times to increase verbosity level).
  • v - Same as VERBOSE
  • LIBRARY - Optional argument allow specifying a library name (can be used multiple times to show multiple libraries in a single command)

Return

Information about the requested libraries.

Example

> RG.FUNCTION list vvv
1)  1) "engine"
    2) "js"
    3) "name"
    4) "lib"
    5) "pending_jobs"
    6) (integer) 0
    7) "user"
    8) "default"
    9) "functions"
   10) 1) 1) "name"
          2) "foo"
          3) "flags"
          4) (empty array)
   11) "stream_consumers"
   12) (empty array)
   13) "notifications_consumers"
   14) (empty array)
   15) "gears_box_info"
   16) (nil)

RG.FUNCTION CALL

Invoke a function.

RG.FUNCTION CALL <library name> <function name> [<arg1> ... <argn>]

Arguments

  • library name - The library name contains the function.
  • function name - The function name to run.
  • arg1 ... argn - Additional argument to pass to the function.

Return

The return value from the function on error in case of failure.

Example

> RG.FUNCTION CALL lib foo
"bar"