upstash-ratelimit-js
作者: upstash
使用 Upstash Redis RateLimit TypeScript/JavaScript SDK 的轻量级指南,包括设置步骤、基本用法以及高级算法参考…
npx skills add https://github.com/upstash/skills --skill upstash-ratelimit-jsRate Limit TS SDK
Quick Start
- Install the SDK and connect to Redis.
- Create a rate limiter and apply it to incoming operations.
Example:
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const redis = new Redis({ url: "<url>", token: "<token>" });
const limiter = new Ratelimit({ redis, limiter: Ratelimit.slidingWindow(5, "10s") });
const { success } = await limiter.limit("user-id");
if (!success) {
// throttled
}
Other Skill Files
- algorithms.md: Describes all available rate‑limiting algorithms and how they behave.
- pricing-cost.md: Explains pricing, Redis cost implications, and operational considerations.
- features.md: Lists SDK features such as prefixes, custom keys, and behavioral options.
- methods-getting-started.md: Full method reference for the SDK's API and getting started guide.
- traffic-protection.md: Guidance on applying rate limiting for traffic shaping, abuse prevention, and protection patterns.
来自 upstash 的更多技能
context7-cli
upstash
使用ctx7 CLI获取库文档、管理AI编码技能以及配置Context7 MCP。当用户提到“ctx7”或“context7”时激活…
official
context7-mcp
upstash
当用户询问库、框架、API参考或需要代码示例时,应使用此技能。适用于设置问题、代码…
official
documentation-lookup
upstash
当用户询问关于库、框架、API参考或需要代码示例时,应使用此技能。适用于设置问题、代码…
official
find-docs
upstash
使用 Context7 CLI 检索任何库的最新文档和代码示例。
official
context7-cli
upstash
使用ctx7 CLI获取库文档、管理AI编码技能以及配置Context7 MCP。当用户提到“ctx7”或“context7”时激活…
official
context7-docs-lookup
upstash
使用Context7获取最新的库文档。当用户询问库、框架、API参考或需要代码示例时激活——…
official
context7-mcp
upstash
当用户询问库、框架、API参考或需要代码示例时,应使用此技能。适用于设置问题、代码…
official
ctx7-cli
upstash
使用ctx7 CLI获取库文档、管理AI编码技能以及配置Context7 MCP。当用户提到“ctx7”或“context7”时激活…
official