@stateloom/persist-redis
v1.0.0-alpha.0
Published
Redis-backed storage adapter for `@stateloom/persist`. Bring your own Redis client -- works with `ioredis`, `redis` (node-redis), and `@upstash/redis`.
Downloads
47
Readme
@stateloom/persist-redis
Redis-backed storage adapter for @stateloom/persist. Bring your own Redis client -- works with ioredis, redis (node-redis), and @upstash/redis.
Install
pnpm add @stateloom/persist @stateloom/persist-redisQuick Start
import Redis from 'ioredis';
import { persist } from '@stateloom/persist';
import { redisStorage } from '@stateloom/persist-redis';
const persistMw = persist<{ count: number }>({
key: 'counter',
storage: redisStorage({
client: new Redis(),
prefix: 'myapp:',
ttl: 3600, // 1 hour
}),
});Exports
| Export | Description |
| ---------------------- | -------------------------------------------------- |
| redisStorage(client) | Create a StorageAdapter backed by a Redis client |
Documentation
Full documentation with API reference, client patterns, and TTL examples: docs/api/persist-redis
License
MIT
