prisma-extension-redis (v2.1.1) is a Prisma client extension that provides transparent caching and cache invalidation using Redis or Dragonfly databases. It wraps Prisma queries to cache results and automatically invalidate related cache entries on mutations. Key features include configurable cache keys, TTL support, and fine-grained invalidation based on model operations. Released as an npm package, it targets Prisma 4+ and Redis 6+. Unlike manual caching solutions, it integrates seamlessly with Prisma's query lifecycle and works with both Redis and Dragonfly.
npm install prisma-extension-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to extend Prisma client with Redis caching, including setup, cached read, and automatic cache invalidation on writes.
Use a shared Redis connection or upgrade to the latest version that supports invalidation events.
Use `prismaExtensionRedis(options)` instead of `new PrismaRedisCache(options)`.
Migrate to object format: `models: { User: { ttl: 60 }, Post: { ttl: 120 } }`.Ensure `await redisClient.connect()` is called before `prisma.$extends()`.
Stick to model names consistent across deployments or implement custom key prefix.
Use `redis` v4+ and install `@redis/client` or `redis` package. Ensure you call `await redisClient.connect()`.
Use named import: `import { prismaExtensionRedis } from 'prisma-extension-redis'`. For CommonJS, use dynamic import.Ensure you use Prisma >=4.7.0 and pass an options object with `models` and `storage`.