Zero extra infra
Reuse the KV namespace you already bind in your Worker. No Redis instance, no connection pool, no cold-start tax.
import { drizzle } from 'drizzle-orm/d1'
import { cloudflareKVCache } from 'drizzle-cloudflare-kv-cache-adapter'
const db = drizzle(env.DB, {
cache: cloudflareKVCache(env.CACHE),
})
// cached, edge-local, auto-invalidated
const users = await db.select().from(usersTable).$withCache()
Zero extra infra
Reuse the KV namespace you already bind in your Worker. No Redis instance, no connection pool, no cold-start tax.
Drop-in adapter
Implements Drizzle’s native cache interface. Pass it to drizzle({ cache })
and use .$withCache() exactly as documented.
Automatic invalidation
Writes through Drizzle invalidate every cached query that touches the mutated tables — via a per-table reverse index in KV.
Edge-native
Built for Cloudflare Workers and D1. Tiny, tree-shakeable, ESM-only, fully typed.