Skip to content
All features
integrationspackages/integrations/cache

cache package

Tag-based cache with Redis, Upstash, or in-memory backend. Same get/set/invalidate(tags) for serverless and self-hosted.

Open docs
Stability
Stable
Scope
Global
Boundary
packages/integrations/cache
Cache observability
Upstash Redisus-east-1

Hit rate

94.7%

+2.1%

Latency p50

1.2ms

−0.3ms

Latency p99

8ms

+1.0ms

Memory

847MB

/ 2GB

Hit ratio
last 5 min
Memory used847 MB / 2 GB
x
Recent keysTTLSize
  • user:abc123:profileHIT58s4.2 KB
  • session:xyz789HIT12m1.1 KB
  • org:42:billingMISS0 B
  • post:9c1f:metaHIT5m812 B
  • rate:ip:10.0.2HIT47s64 B
  • feed:home:v3MISS0 B
Usagecache.ts
typescript
cache.ts
1import { getCache } from "@nebutra/cache";
2
3const cache = await getCache();
4
5const user = await cache.fetch(`user:${id}`, {
6  ttl: 60,
7  fetcher: () => prisma.user.findUnique({ where: { id } }),
8});
9
10await cache.invalidate(`user:${id}`);