@flightdev/cache-upstash
v0.0.7
Published
Upstash Redis cache adapter for Flight Framework - serverless and edge compatible
Downloads
8
Maintainers
Readme
@flightdev/cache-upstash
Upstash Redis cache adapter for Flight Framework. Serverless-optimized Redis caching.
Installation
npm install @flightdev/cache-upstashQuick Start
import { createCache } from '@flightdev/core/cache';
import { upstash } from '@flightdev/cache-upstash';
const cache = createCache(upstash({
url: process.env.UPSTASH_REDIS_REST_URL,
token: process.env.UPSTASH_REDIS_REST_TOKEN,
}));
await cache.set('key', 'value', { ttl: 3600 });
const value = await cache.get('key');Configuration
upstash({
// Upstash REST API URL
url: process.env.UPSTASH_REDIS_REST_URL,
// Upstash REST API token
token: process.env.UPSTASH_REDIS_REST_TOKEN,
// Key prefix
prefix: 'cache:',
// Default TTL in seconds
ttl: 3600,
// Automatic JSON serialization
automaticDeserialization: true,
});Why Upstash?
- Serverless-optimized (HTTP-based, no connection pooling needed)
- Edge-compatible (works in Cloudflare Workers, Vercel Edge, etc.)
- Pay-per-request pricing
- Global replication
License
MIT
