- 稳定性
- 稳定
- 作用域
- 全局
- 边界
- packages/integrations/cache
缓存可观测性
Upstash Redisus-east-1
命中率
94.7%
+2.1%
延迟 p50
1.2ms
−0.3ms
延迟 p99
8ms
+1.0ms
内存
847MB
/ 2GB
命中比
近 5 分钟
已用内存847 MB / 2 GB
最近键TTL大小
- user:abc123:profileHIT58s4.2 KB
- session:xyz789HIT12m1.1 KB
- org:42:billingMISS—0 B
- post:9c1f:metaHIT5m812 B
- rate:ip:10.0.2HIT47s64 B
- feed:home:v3MISS—0 B
使用方式cache.ts
typescriptcache.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}`);