Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (48 sloc) 1.42 KB


Here are are a few basic examples that should get you started.

Hello world!

The most basic program you can run will just print "Hello world!" to the log when starting.

Create the following JavaScript file and call it hello.js:

Redis.warn("Hello world!");

Now start your custom Redis server and connect via a client (one is conveniently compiled along with the server):

cd /path/to/custom/redis/src
./redis-server --port 7000

In another terminal window

cd /path/to/custom/redis/src
./redis-cli -p 7000

Load the module> module load /path/to/ /path/to/hello.js

In your redis server window you should see something simiar to this:

19538:M 17 Jun 15:37:32.549 * Ready to accept connections
19538:M 17 Jun 15:37:43.525 # <cthulhu> Hello world!
19538:M 17 Jun 15:37:43.525 * Module 'cthulhu' loaded from /path/to/

Hello $name!

Let's try to actually export a function this time. Change your hello.js to read:

function hello(name) {
    Redis.warn("Hello " + name + "!" );

Reload the module> module unload cthulhu> module load /path/to/ /path/to/hello.js

Now try to invoke the command passing your name> invoke hello Marco

In the logs you should see something like

19538:M 17 Jun 15:43:12.845 # <cthulhu> Hello Marco!