A cache adapter for Drizzle ORM that uses unstorage as the backend, allowing you to plug in any unstorage driver (Redis, LRU, filesystem, Cloudflare KV, Upstash, etc.). Version 1.0.0 requires drizzle-orm >=0.45.1 and unstorage >=1.17.3. It implements Drizzle's custom cache interface and provides storage-agnostic caching with per-query TTL overrides, global caching, and debug logging. Unlike driver-specific cache solutions, this package is lightweight and unopinionated about the driver. Known not to support SQLite-based drivers (better-sqlite3, bun-sqlite, etc.) with drizzle-orm 0.45.
npm install drizzle-uncacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes an unstorage Redis-backed cache, connects to PostgreSQL via Drizzle, and runs a cached query.
Use a different driver (Redis, LRU, fs-lite, etc.) or upgrade to a future version that may support SQLite drivers.
Always set at least one TTL field if you want entries to expire. Use `keepTtl: true` to preserve the existing entry's TTL.
Choose a consistent `base` value and do not change it after the cache is populated, or implement a migration strategy.
Use `global: true` only after verifying that your application tolerates cached results. Use per-query `.withCache()` for selective caching.
Only enable debug in development. Remove or set `debug: false` in production.
Ensure `unstorage` is installed and the specific driver package (e.g., `@unstorage/driver-redis`) is installed if required. For Redis, install `ioredis` and use the correct driver path.
Install drizzle-uncache: `npm install drizzle-uncache`. Ensure TypeScript >= 4.7 and set `moduleResolution: "node16"` or `"bundler"` in tsconfig.json.
Run `npm install drizzle-orm@^0.45.1 unstorage@^1.17.3` along with drizzle-uncache.
Wrap the storage in an options object: `unstorageCache({ storage: myStorage, config: { ex: 60 } })`