百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

RedisGears

> 数据库
开源

用于您的 Redis 数据的动态执行框架

383 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于您的 Redis 数据的动态执行框架

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustanalyticsmapreduceredisredisgears

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

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