Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

RedisGears

> 数据库
Open source

Dynamic execution framework for your Redis data

383 stars0 likes0 views
WebsiteGitHub

About

Dynamic execution framework for your Redis data

Triggers and Functions

A Redis module that allows running a JS functions inside the Redis processes. The JS code is execute use V8 JS engine.

Notice, Triggers and Functions is still under active development and not yet GA. The API might (and probably will) change at the final GA version.

Run Using Docker

bash
docker run -p 6379:6379 redislabs/redisgears:edge

How do I Redis?

Learn for free at Redis University

Build faster with the Redis Launchpad

Try the Redis Cloud

Dive in developer tutorials

Join the Redis community

Work at Redis

Build

With Docker

Run the following on the main directory:

bash
> docker build -t redisgears2 .

Then run the built image:

bash
> docker run -p 6379:6379 redisgears2

From Source

See the build page for more information.

Getting started

Run JS code

The API exposed by the module is very similar to the way Redis Functions work. Let's write a simple hello world function that returns the string hello world:

javascript
#!js name=lib api_version=1.0

redis.registerFunction('hello_world', function(){
    return 'hello_world';
});

The first line indicates the engine to use (js) and the library name (lib). The rest is the library code.

Assuming we put the following code in the file lib.js, we can register our function in Redis using the TFUNCTION LOAD command:

bash
> redis-cli -x TFUNCTION LOAD  redis-cli TFCALL lib.hello_world 0
"hello_world"

Notice that the TFCALL command arguments are very close to the Redis FCALL command arguments. The only difference is that, for Triggers and Functions, the command also requires the library name. The 0 represents the number of keys that will follow, which in our case is 0.

Calling Redis Commands Inside Triggers and Functions

It is possible to call Redis commands inside Triggers and Functions. The function gets as the first argument a client object that allows interaction with Redis using the call function. The following example executes a simple PING command and returns the result:

javascript
#!js name=lib api_version=1.0

redis.registerFunction('my_ping', function(client){
    return client.call('ping');
});

If we will try to send it to our running Redis instance, we will get the following error:

bash
> redis-cli -x TFUNCTION LOAD  redis-cli -x TFUNCTION LOAD UPGRADE  redis-cli TFCALL lib.my_ping 0
"PONG"

What's next?

  • Quick Start
  • Official documentation
  • Commands
  • Configuration
  • Sync and Async Run
  • KeySpace Triggers
  • Stream Triggers
  • Cluster support
  • JS API

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustanalyticsmapreduceredisredisgears

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库