TFUNCTION LOAD

Syntax
TFUNCTION LOAD [REPLACE] [CONFIG <config>] "<library code>" 
Available in:
Redis Stack / Triggers and functions 2.0.0
Time complexity:
O(1)

Load a new JavaScript library into Redis.

Required arguments

library code

The library code.

Optional arguments

replace

Instructs Redis to replace the function if it already exists.

config

A string representation of a JSON object that will be provided to the library on load time, for more information refer to library configuration.

Return

TFUNCTION LOAD returns either

  • "OK" when the library was loaded correctly.
  • Error reply when the library could not be loaded.

Examples

TFUNCTION LOAD "#!js api_version=1.0 name=lib\n redis.registerFunction('hello', ()=>{return 'Hello world'})"
1) "OK"

See also

Rate this page