eventModel = $eventModel; $this->cache = $cache; } public function getStats(): JsonResponse { $stats = $this->cache->get(self::CACHE_KEY); if ($stats === null) { $stats = $this->eventModel->getStats(); $this->cache->set(self::CACHE_KEY, $stats, self::CACHE_TTL); } return new JsonResponse(['data' => $stats]); } }