@antelopejs/redis

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

用于羚羊JS的 Redis 模块,执行与 ioredis 的 Redis 和 Redis 调度接口

中文使用文档
文档目录8 节
  1. 接口
  2. 安装
  3. 配置
  4. 快开始
  5. 文档
  6. 兼容性
  7. 捐款
  8. 许可证

@antelopejs/redis

npm License Discord Documentation

羚羊JS的雷迪斯模块. 它连接一个共享 ioredis 客户端并服务于 Redis 和 Redis 调度器接口.

接口

接口文档
@antelopejs/interface-redis重写
@antelopejs/interface-redis-scheduler重排调度器

调度器运行在 Redis 客户端上方的界面包内,因此除了这个模块,它不需要模块.

安装

ajs project modules add @antelopejs/redis

命令会写入模块的默认配置, 它连接到 redis://localhost:6379。 。 。 .

配置

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",
  },
});
密钥说明
urlRedis 连接 URL. 可选的 没有它,客户会使用以下选项,或者 localhost:6379。 。 。 .
useMock做梦 ioredis-mock 客户端而不是连接,而忽略了所有其他密钥。 只能做测试.
任何其它键传递给客户端 ioredis 选项,例如 host, (中文(简体) ), port, (中文(简体) ), password, (中文(简体) ), db, (中文(简体) ), tls 或者说 lazyConnect。 。 。 .

模块启动时创建客户端,停止时退出. 与 lazyConnect: true,模块在为客户端服务之前等待连接.

快开始

在使用Redis的模块中,添加接口:

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() 等待模块启动并设置客户端。 对分布式工作,加 @antelopejs/interface-redis-scheduler 读它 文档。 。 。 .

文档

  • 重写 文档 @antelopejs/interface-redis 与本模块执行的合同.
  • 重排调度器 文档 @antelopejs/interface-redis-scheduler 与本模块执行的合同.
  • 配置 文档模块来源, config 块和配置变量 antelope.config.ts。 。 。 .

兼容性

软件包支助测试过
@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 设置用于发展的节点.js发布,以及 dependencies 联 合 国 package.json 设置 ioredis 范围.

捐款

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

测试不需要 Redis 服务器 。 读取 捐款准则 在你打开拉动请求之前.

许可证

阿帕奇 - 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 是什么?

用于羚羊JS的 Redis 模块,执行与 ioredis 的 Redis 和 Redis 调度接口

如何安装 @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 和提交记录判断。