michael-rubel/lada-cache
Lada Cache is a Redis-based automatic query cache for Laravel. It caches Eloquent queries and invalidates entries when related models change, requiring little configuration while speeding up reads and keeping cached data consistent across scalable applications.
Architecture fit: michael-rubel/lada-cache is a Laravel-specific, Redis-backed query cache that transparently intercepts database queries, hashes SQL plus bindings, stores results in Redis, and tags entries by table for invalidation on writes. It fits only if the application is Laravel, already operates Redis, and is read-heavy with repeated query patterns. It is a cross-cutting data-layer dependency, not a feature package, so it should be evaluated like infrastructure. It can conflict with existing response caching, Eloquent caching, or explicit cache-key strategies.
Integration feasibility: Technically low-effort: Composer install, publish config, configure Redis connection, enable per database connection. No schema migration is required because the cache is ephemeral. The real effort is correctness validation: transactions, raw SQL, joins, aggregates, pagination, multiple connections, read/write splitting, and non-deterministic queries must be tested. The package remains pre-1.0 (latest release 0.0.2, prior 0.0.1), so API stability and Laravel 11/12 and PHP 8.3+ compatibility are unproven and must be verified from composer.json and source. The 0.0.2 release only fixes withCount usage (PR #4), which confirms aggregate/count handling was incorrect in the only prior version — a material finding for a package whose value proposition is query-result correctness.
Technical risk: High. Adoption signals remain weak: single maintainer, no dependent ecosystem, no evidence of production use, and a version scheme that signals alpha-grade stability. The 0.0.2 withCount fix is direct evidence that query-shape coverage is incomplete and that aggregate queries were returning wrong counts — exactly the class of silent correctness failure this package can introduce. Automated invalidation remains the primary correctness risk. Raw queries, writes inside transactions, multi-tenant scoping, Redis Cluster tag behavior, and cache eviction can produce stale reads or invalidation misses. Redis becomes a correctness-sensitive dependency, not just a performance optimization. There is also key-collision and cache-stampede risk under load. A TPM should treat this as a fork-and-own candidate, not a drop-in vendor dependency.
Key questions:
withCount, withSum, withExists, whereHas, and other subquery-generated SQL produce correct keys and correct invalidation, or are there further undiscovered gaps like the one fixed in 0.0.2?Stack fit: Best fit is a Laravel 9/10 application on PHP 8.1/8.2 with Redis 6/7 already used for cache, sessions, or queues. Use a dedicated Redis database or instance for Lada Cache to avoid eviction pressure on sessions and queues. Confirm the Redis client (predis vs phpredis) and whether Redis Cluster is in use before enabling.
Migration path: No data migration. Treat rollout as a performance experiment with a kill switch. Start in staging, enable caching for one read-heavy connection or service boundary, and run a correctness harness that compares cached and uncached results across CRUD, transactions, joins, aggregates (including withCount and other Eloquent aggregate helpers), pagination, and raw queries. Measure hit rate, p95 latency, and Redis memory before production.
Compatibility: Pin the package version and test against the exact Laravel/PHP/Redis matrix. The jump from 0.0.1 to 0.0.2 with a silent correctness fix underscores that patch versions may change query results, so treat every upgrade as a behavioural change requiring re-running the correctness harness. If the application is on Laravel 11+, assume a fork may be required. Avoid enabling on connections with read/write splitting, multiple schemas, or heavy raw SQL until those paths are proven. Document the supported matrix as an internal constraint.
Sequencing:
withCount, withSum, withExists, whereHas, and other subquery/aggregate constructs.composer.json constraints against the target stack, and diff 0.0.1→0.0.2 to understand the scope of the fix.Maintenance: Expect to fork or vendor the package. With one maintainer, minimal adoption signals, a pre-1.0 version, and a track record of correctness bugs being found post-release (withCount in 0.0.2), there is no credible upgrade path for future Laravel versions without internal ownership. Budget engineering time for compatibility patches, security review, and Redis behavior testing. Maintain a pinned version and re-run the full correctness harness on every release, including patch bumps.
Support: Community-only support with effectively no ecosystem. The original Lada Cache project may be a reference, but this fork/derivative has minimal evidence of production use. Create an internal runbook covering configuration, kill switch, Redis failover, and stale-cache remediation. Because correctness defects are being surfaced by first-time contributors, assume similar issues will surface reactively rather than through maintainer-led QA.
Scaling: Redis memory is the primary constraint. Query result payloads can be large, and tag/invalidation metadata must remain resident for correctness. Monitor memory, eviction counts, hit rate, and invalidation volume. Cold-start and high-concurrency traffic can cause cache stampedes against the database; load test before broad rollout. Multi-tenant or high-cardinality binding sets can inflate key space.
Failure modes: Redis outage may cause application errors if the package does not fail open. Eviction of tag metadata can cause invalidation misses and stale reads. Transaction rollbacks, raw SQL, and multi-connection writes can leave stale entries. Query-shape gaps — as demonstrated by the withCount bug in 0.0.1 — can silently return incorrect aggregate results while appearing to hit the cache normally. Cache poisoning or key collisions are possible if key construction is not robust. Plan for a config-level disable path and a Redis flush procedure per environment.
Ramp-up: Low for Laravel developers to install; moderate for operations to isolate Redis and monitor; high for correctness debugging across transactions, raw SQL, aggregates, and tenant boundaries — a discipline the 0.0.2 release confirms is necessary. Require observability for hit rate, invalidation counts, Redis memory/eviction, query latency, and stale-read incidents before production adoption.
How can I help you explore Laravel packages today?