@antelopejs/redis

中文文档
1.1.0发布于 2026/11/04Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 2143

Redis module for AntelopeJS, implementing the Redis and Redis Scheduler interfaces with ioredis

原始使用文档
文档目录8 节
  1. Interfaces
  2. Install
  3. Configuration
  4. Quick start
  5. Documentation
  6. Compatibility
  7. Contributing
  8. License

@antelopejs/redis

npm License Discord Documentation

The Redis module of AntelopeJS. It connects one shared ioredis client and serves it to the Redis and Redis Scheduler interfaces.

Interfaces

InterfaceDocumentation
@antelopejs/interface-redisRedis
@antelopejs/interface-redis-schedulerRedis Scheduler

The scheduler runs inside its interface package on top of the Redis client, so it needs no module besides this one.

Install

ajs project modules add @antelopejs/redis

The command writes the module's default configuration, which connects to redis://localhost:6379.

Configuration

import { defineConfig } from "@antelopejs/interface-core/config";

export default defineConfig({
  name: "my-project",
  modules: {
    redis: {
      source: {
        type: "package",
        package: "@antelopejs/redis",
        version: "^1.0.3",
      },
      config: {
        url: "redis://localhost:6379",
        useMock: false,
        lazyConnect: true,
      },
    },
  },
  envOverrides: {
    REDIS_URL: "modules.redis.config.url",
  },
});
KeyDescription
urlRedis connection URL. Optional. Without it, the client uses the options below, or localhost:6379.
useMockServes an in-memory ioredis-mock client instead of connecting, and ignores every other key. For tests only.
any other keyPassed to the client as ioredis options, such as host, port, password, db, tls or lazyConnect.

The module creates the client when it starts, and quits it when it stops. With lazyConnect: true, the module waits for the connection before it serves the client.

Quick start

In the module that uses Redis, add the interface:

pnpm add @antelopejs/interface-redis
import { GetClient } from "@antelopejs/interface-redis";

const client = await GetClient();
await client.set("greeting", "hello", "EX", 60);
const greeting = await client.get("greeting");

GetClient() waits until the module has started and set its client. For distributed jobs, add @antelopejs/interface-redis-scheduler and read its documentation.

Documentation

  • Redis documents the @antelopejs/interface-redis contract that this module implements.
  • Redis Scheduler documents the @antelopejs/interface-redis-scheduler contract that this module implements.
  • Configuration documents module sources, config blocks and config variables in antelope.config.ts.

Compatibility

PackageSupportedTested with
@antelopejs/interface-core>=0.2.4 <1.0.00.2.4
@antelopejs/interface-redis>=0.0.9 <1.0.00.0.9
@antelopejs/interface-redis-scheduler>=0.0.8 <1.0.00.0.8

.nvmrc sets the Node.js release for development, and the dependencies of package.json set the ioredis range.

Contributing

pnpm install
pnpm dev            # run the playground/ project against redis://127.0.0.1:6379
pnpm lint
pnpm format:check
pnpm knip
pnpm test           # build, then ajs module test with ioredis-mock

The tests need no Redis server. Read the contribution guidelines before you open a pull request.

License

Apache-2.0

版本与发布记录

@antelopejs/redis 共发布 9 个版本,首次发布于 2025/05/09;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.1.0latest2026/11/043 天前
1.0.42026/10/1721 天前
1.0.32026/08/212 个月前
1.0.22026/06/164 个月前
1.0.12026/03/257 个月前
1.0.02026/03/247 个月前

关于 @antelopejs/redis 的常见问题

@antelopejs/redis 是什么?

Redis module for AntelopeJS, implementing the Redis and Redis Scheduler interfaces with ioredis

如何安装 @antelopejs/redis?

在项目目录运行 npm install @antelopejs/redis,或使用 pnpm add / yarn add / bun add。

@antelopejs/redis 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@antelopejs/redis 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@antelopejs/redis 可以商用吗?

@antelopejs/redis 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@antelopejs/redis 的下载量有多少?

根据 npm 官方下载统计,@antelopejs/redis 在 2026/10/06 – 2026/11/04 这 30 天内被下载 2,143 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@antelopejs/redis 还在维护吗?

最新版本 1.1.0 发布于 2026/11/04(3 天前);至今共发布 9 个版本,其中过去 12 个月发布了 7 个;首次发布于 2025/05/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。