@nostr-dev-kit/cache-upstash
v0.1.3
Published
NDK Upstash REST Cache Adapter
Readme
cache-upstash
NDK cache adapter for Upstash Redis over REST.
This adapter is designed for serverless and edge-friendly deployments. It only indexes exact filter shapes that are safe and predictable for SSR cache hits:
idskinds + authorskinds + authors + #d
Unsupported filters are treated as cache misses.
Install
npm add @nostr-dev-kit/cache-upstashUsage
import NDK from "@nostr-dev-kit/ndk";
import NDKCacheUpstashAdapter from "@nostr-dev-kit/cache-upstash";
const cacheAdapter = new NDKCacheUpstashAdapter({
url: process.env.UPSTASH_REDIS_REST_URL,
token: process.env.UPSTASH_REDIS_REST_TOKEN,
namespace: "my-app:ssr:v1",
expirationTime: 3600
});
const ndk = new NDK({ cacheAdapter });You can also pass an existing @upstash/redis client via the redis option.
License
MIT
