- Redis
- Prisma
- PostgreSQL
Caching Prisma queries with Redis
A simple read-through cache that cut dashboard load times on the Bio Lab project — plus the invalidation rules that kept data fresh.
Talha Sajid5 min read
The lab dashboards ran the same aggregate queries on every page load. PostgreSQL handled it, but the charts felt sluggish once the data grew.
Read-through, keyed by query
Each cached query gets a key built from its name and arguments. On a miss, the result is fetched through Prisma, stored with a short TTL, and returned.
Invalidate on write
Any mutation that touches a reservation deletes the related keys. Short TTLs act as a safety net for anything the rules miss.