upstash/redis-js
Tentang
Klien Redis berbasis HTTP untuk fungsi Serverless dan Edge
Data dan analisisPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- +2
- dalam 15 hari
- +2
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliUpstash Redis
@upstash/redis is an HTTP/REST based Redis client for typescript, built on top
of Upstash REST API.
[!NOTE]
This project is in GA Stage.The Upstash Professional Support fully covers this project. It receives regular updates, and bug fixes. The Upstash team is committed to maintaining and improving its functionality.
It is the only connectionless (HTTP based) Redis client and designed for:
- Serverless functions (AWS Lambda ...)
- Cloudflare Workers (see the example)
- Fastly Compute@Edge (see the example)
- Next.js, Jamstack ...
- Client side web/mobile applications
- WebAssembly
- and other environments where HTTP is preferred over TCP.
See the list of APIs supported.
Quick Start
Install
Node.js
npm install @upstash/redis
Deno
import { Redis } from "https://esm.sh/@upstash/redis";
Create database
Create a new redis database on upstash
Basic Usage:
import { Redis } from "@upstash/redis"
const redis = new Redis({
url: <UPSTASH_REDIS_REST_URL>,
token: <UPSTASH_REDIS_REST_TOKEN>,
})
// string
await redis.set('key', 'value');
let data = await redis.get('key');
console.log(data)
await redis.set('key3', 'value3', {ex: 1});
// sorted set
await redis.zadd('scores', { score: 1, member: 'team1' })
data = await redis.zrange('scores', 0, 100 )
console.log(data)
// list
await redis.lpush('elements', 'magnesium')
data = await redis.lrange('elements', 0, 100 )
console.log(data)
// hash
await redis.hset('people', {name: 'joe'})
data = await redis.hget('people', 'name' )
console.log(data)
// sets
await redis.sadd('animals', 'cat')
data = await redis.spop('animals', 1)
console.log(data)
Troubleshooting
We have a dedicated page for common problems. If you can't find a solution, please open an issue.
Docs
See the documentation for details.
Resources
- Examples — runnable usage examples across runtimes and frameworks
- xadd — engineering blog about Redis
- Search Upstash Redis docs with AI — query the docs via Context7
Release Workflow
Stable Release
- Create a changeset (
pnpm changeset) describing your changes and merge it tomain - Changeset workflow runs on push to
main. If changesets are pending, it opens a "Version Packages" PR. When that PR is merged, the workflow runs again, publishes git tags, creates GitHub releases, and uploads arelease-metaartifact - Router workflow detects the Changeset completion via
workflow_run, downloads therelease-metaartifact, and calls the npm Publish workflow withprerelease: falseand the resolved version - npm Publish checks out the released commit, builds, and publishes to npm under the
latesttag
Canary Release
- Trigger the Canary Release workflow manually from the Actions tab, selecting the package
- It creates a snapshot version (
x.y.z-canary.{timestamp}), creates a GitHub prerelease, and uploads arelease-metaartifact - Router picks it up the same way, calling npm Publish with
prerelease: true - npm Publish publishes to npm under the
canarytag
CI Tests
On every pull request, push to main, and daily schedule, the Router workflow runs the Tests workflow (unit tests, lint, build, and example integration tests).
Contributing
Install Bun
Database
Create a new redis database on upstash and copy the url and token
Running tests
bun run test
Building
bun run build
Telemetry
This library sends anonymous telemetry data to help us improve your experience. We collect the following:
- SDK version
- Platform (Deno, Cloudflare, Vercel)
- Runtime version ([email protected])
- Retry count of retried requests (to measure retry rates)
You can opt out by setting the UPSTASH_DISABLE_TELEMETRY environment variable
to any truthy value.
UPSTASH_DISABLE_TELEMETRY=1
Alternatively, you can pass enableTelemetry: false when initializing the Redis client:
const redis = new Redis({
// ...,
enableTelemetry: false,
});
Jelajahi proyek terkait
Memuat…