spiritix/lada-cache
Redis-backed, fully automated query cache for Laravel. Transparently accelerates Eloquent and Query Builder with granular, automatic invalidation (rows/tables), scalable for clusters, with controls to include/exclude tables and optional Debugbar insights.
DB facade and Eloquent models transparently, requiring minimal code changes (e.g., adding LadaCacheTrait to models).insert, update, delete) via Laravel’s event system (e.g., MigrationsEnded). This reduces manual invalidation overhead.LadaCacheTrait can be added incrementally to models.fruitcake/laravel-debugbar), providing visibility into cache hits/misses/invalidations. This is critical for diagnosing performance bottlenecks..env (e.g., LADA_CACHE_ACTIVE) and config/lada-cache.php (e.g., excluded tables, Redis connection, TTL).UNION, INTERSECT, raw queries) may not be fully supported for row-level tagging, falling back to table-level invalidation. This could lead to cache stampedes for high-traffic queries.DB layer may not integrate with Lada Cache. Testing with existing packages (e.g., Scout, Eloquent relationships) is essential.maxmemory-policy)?UNIONs) that could bypass caching?php artisan lada-cache:flush) be managed in production?predis/predis and phpredis drivers. Cluster-ready with Redis Sentinel or Redis Cluster.fruitcake/laravel-debugbar for cache visualization. Telescope integration is noted but may require additional setup.composer require spiritix/lada-cache
php artisan vendor:publish --provider="Spiritix\LadaCache\LadaCacheServiceProvider"
LadaCacheTrait to a subset of models (e.g., high-traffic read models)..env:
LADA_CACHE_ACTIVE=true
LADA_CACHE_DEBUGBAR=true
exclude_tables in config).redis-cli --stat, Prometheus exporter).LadaCacheTrait on models. Inheritance (e.g., BaseModel) simplifies adoption.DB::table() and DB::select() calls. Raw SQL (e.g., DB::statement()) is excluded by design.with() clauses may require testing.MigrationsEnded event (configurable).Cache::remember). Uses Redis separately.config/database.php (e.g., redis_connection in Lada Cache config).config/lada-cache.php (e.g., enabled_tables, ttl)..env flags (LADA_CACHE_ACTIVE, LADA_CACHE_DEBUGBAR).LadaCacheTrait to models incrementally, starting with high-impact tables.config/lada-cache.php) reduces drift risk. Use environment variables for runtime toggles (e.g., LADA_CACHE_ACTIVE).maxmemory-policy (e.g., allkeys-lru) and monitor usage.redis-cli --rdb).php artisan lada-cache:flush) should be logged and audited.How can I help you explore Laravel packages today?