spiritix/lada-cache
Redis-backed, fully automated query cache for Laravel. Transparently caches Eloquent/Query Builder queries with granular invalidation (rows/tables), scales across Redis/cluster setups, supports include/exclude tables, and integrates with Laravel Debugbar.
eloquent.saved, eloquent.deleted). This ensures consistency without manual intervention.LadaCacheTrait enables caching for Eloquent models, while the connection integration handles Query Builder queries.DB::select()). Testing with critical dependencies (e.g., Scout, Eloquent events) is essential.UNION, subqueries, dynamic SQL) may lead to incorrect caching or invalidation. The changelog highlights fixes for nested joins and complex queries (e.g., issues #142, #149).DB facade and integrates with Eloquent events.predis or phpredis).eloquent.saved) for invalidation, reducing coupling.spiritix/lada-cache to composer.json.php artisan vendor:publish --provider="Spiritix\LadaCache\LadaCacheServiceProvider").LadaCacheTrait to a base model or relevant models..env (LADA_CACHE_ACTIVE=true).lada-cache.redis_connection).exclude_tables in config).withoutCache(), raw SQL).spatie/laravel-query-builder or custom macros. Test thoroughly.User, Product).use LadaCacheTrait selectively).config/lada-cache.php) reduces drift but requires version control for changes.spiritix/lada-cache for Laravel/PHP version support. Example: Laravel 13 support added in 6.1.withoutCache()).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Redis downtime | Cache misses → DB load spikes | Configure LADA_CACHE_FALLBACK=true |
| Cache stampede | High DB load if many keys expire simultaneously | Use Redis pipelining or local LRU cache |
| Incorrect invalidation | Stale data returned | Test with withoutCache() for validation |
| Query reflection bugs | Wrong cache keys or invalidation tags | Monitor Debug |
How can I help you explore Laravel packages today?