Hey everyone 👋
Over the past few months, I’ve been working on a small open-source package called laravel-normcache.
It actually started from a problem I kept running into across a few different projects. I found myself repeatedly building the same kind of caching layer to avoid redundant Eloquent data sitting everywhere in Redis, so eventually I thought: why not turn it into a reusable package and learn more deeply how Laravel caching works under the hood?
A lot of the ideas are inspired by patterns used in things like Redux/Apollo normalized stores, and I’ve been experimenting and refining things as I use it across real projects.
The main idea behind laravel-normcache is normalizing cached Eloquent results instead of storing entire query collections repeatedly. It stores individual models and query ID maps separately, so when one model changes, every cached query containing that model automatically reflects the update.
Query cache → "posts where active=1, page 2" → [4, 7, 12]
Model cache → post:4 → { id:4, title:..., body:... }
→ post:7 → { id:7, title:..., body:... }
→ post:12 → { id:12, title:..., body:... }
Some things it currently does:
- Automatic caching + invalidation with just a single trait
- Avoids storing duplicate model data across query caches
- Instant consistency across cached query results
- O(1) invalidation using versioned cache keys
- Uses dramatically less Redis memory compared to traditional query caching approaches
There’s still plenty I want to improve and optimize over time, but I felt it was finally in a good enough place to share with the community.
Here’s a quick benchmark comparing direct DB queries vs laravel-model-cache for reference:

I’d genuinely appreciate any feedback, criticism, ideas, or contributions from people more experienced than me. I’m mainly here to learn and improve as an open-source developer.
Repository: https://github.com/kai-init/laravel-normcache
Thanks for reading 🙏