feat: Phase 1 - Redis config, Dashboard cache, Report cache, N+1 fixes, observers

- Add predis/predis for Redis support
- Configure cache/queue defaults to redis in config + .env.example
- Create DashboardController with 60s cache for dashboard queries
- Add cache (5min) to ReportController::generate() and preview()
- Add FeatureObserver, InspectionObserver, IssueObserver for cache invalidation
- Fix N+1 in ProjectMap (eager load template, images), TaskManager (subtasks.parentTask)
- Register observers in AppServiceProvider

Tests: 101 passing (319 assertions)
This commit is contained in:
Javier Braña
2026-08-31 09:44:33 +02:00
parent 90630379fb
commit 78d1dbf45a
16 changed files with 1029 additions and 49 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Observers;
use App\Models\Feature;
use Illuminate\Support\Facades\Cache;
class FeatureObserver
{
public function saved(Feature $feature): void
{
$this->clearReportCache($feature->project_id);
}
public function deleted(Feature $feature): void
{
$this->clearReportCache($feature->project_id);
}
private function clearReportCache(?int $projectId): void
{
if ($projectId) {
Cache::tags(["report:project:{$projectId}"])->flush();
}
}
}