spiritix/lada-cache
Lada Cache is a Redis-based, fully automated query cache layer for Laravel. It transparently caches Eloquent and Query Builder queries, invalidates only the affected rows or tables, requires no code changes, and scales horizontally with Debugbar support.
BaseModel, and every Eloquent and Query Builder read becomes cacheable. That makes it a candidate for a cheap-first roadmap item — ship caching before committing to read replicas, query rewrites, or a database tier upgrade.Cache::remember() calls plus hand-written invalidation. That work is invisible to users, easy to get wrong, and accumulates as a permanent maintenance tax on every feature team. Adopting an MIT-licensed package that derives cache keys from SQL and invalidates on writes replaces a recurring internal build with a one-time integration.include/exclude tables and per-query withoutCache(), the PM can sequence rollout: enable broadly, then carve out freshness-critical paths rather than gate the whole program on a perfect policy.lada-cache:flush, :enable, :disable), the LADA_CACHE_ACTIVE env flag, auto-flush after migrations, and Debugbar integration mean the PM can ask for a real rollout plan — shadow mode, per-environment flags, on-call runbook, hit-rate dashboards — rather than a binary flip.DB::select(), DB::statement()) which is uncached by design.Adopt when most of these hold:
withoutCache().Look elsewhere — or scope down hard — when:
$connection work, but hand-managed connections do not. Audit this before committing.lockForUpdate/sharedLock bypass the cache in 6.x, which is correct but may undercut the expected win.For executives: We can buy 10–30% faster response times and a meaningful reduction in database load for the cost of a Composer dependency and a small integration task — no rewrite, no new infrastructure beyond Redis we already run, no schema migration. It is MIT-licensed and actively maintained through Laravel 13. The trade-off is a new operational dependency and a small, single-maintainer risk that we mitigate with a version pin and a vendored-fork fallback. Recommendation: run it as a time-boxed, staged experiment on read-heavy surfaces with a measurable hit-rate target, and decide on broader rollout against that data rather than on the vendor's benchmarks.
For engineering: It intercepts the database layer by registering a Lada-aware connection that returns a custom query builder. Cache keys are derived from SQL + bindings + database; reads are served from Redis; writes invalidate by row-level tags with table-level fallback. Integration is a trait on a shared BaseModel plus a published config; per-query escape hatch is withoutCache(). Known edges we must design around and test for: non-standard or composite primary keys degrade to table-level invalidation; UNION/INTERSECT/advanced expressions fall back to table-level tagging; raw SQL isn't cached; third-party packages with custom query builders may silently bypass the cache; multiple connections require the integration path. We should ship behind LADA_CACHE_ACTIVE=false in production initially, wire a cache hit/miss metric into staging, and treat migrations plus the lada-cache:flush runbook as part of the change. Success criteria up front: measured p95 improvement and Redis hit rate on the target surfaces, plus zero stale-data incidents over a defined bake period.
How can I help you explore Laravel packages today?