| name | redis-caching |
| description | Explains why plain JSON.stringify/parse breaks when caching Prisma results that contain BigInt fields, and the RedisCache class that fixes it. Use before caching any Prisma model result in Redis. |
Redis Caching & BigInt
Several Prisma models use BigInt fields (e.g. ProfileView). Plain JSON.stringify/JSON.parse throws on BigInt, which breaks naive Redis caching of these rows.
Use the custom RedisCache class from src/utils/cache.ts - it handles BigInt serialization/deserialization automatically. Don't hand-roll JSON.stringify for caching Prisma results without checking the model for BigInt fields first.