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