Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\View\Caching;
|
||||
|
||||
use App\Framework\Cache\Cache;
|
||||
use App\Framework\Cache\CacheItem;
|
||||
use App\Framework\View\Caching\Analysis\CacheStrategy;
|
||||
use App\Framework\View\Caching\Analysis\TemplateAnalysis;
|
||||
use App\Framework\View\Caching\Analysis\TemplateAnalyzer;
|
||||
@@ -11,12 +14,11 @@ use App\Framework\View\Caching\Strategies\FragmentCacheStrategy;
|
||||
use App\Framework\View\Caching\Strategies\FullPageCacheStrategy;
|
||||
use App\Framework\View\Caching\Strategies\NoCacheStrategy;
|
||||
use App\Framework\View\Caching\Strategies\ViewCacheStrategy;
|
||||
use App\Framework\View\RenderContext;
|
||||
use Archive\Archived\SmartCacheEngine;
|
||||
|
||||
class CacheManager
|
||||
{
|
||||
private array $strategies = [];
|
||||
|
||||
private ?TemplateAnalysis $lastAnalysis = null;
|
||||
|
||||
public function __construct(
|
||||
@@ -37,24 +39,34 @@ class CacheManager
|
||||
// 2. Passende Strategy auswählen
|
||||
$strategy = $this->selectStrategy($analysis);
|
||||
|
||||
if (!$strategy->shouldCache($context)) {
|
||||
return $renderer();
|
||||
if (! $strategy->shouldCache($context)) {
|
||||
$content = $renderer();
|
||||
if (! is_string($content)) {
|
||||
throw new \RuntimeException('Renderer must return a string, got: ' . get_debug_type($content));
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
// 3. Cache-Key generieren
|
||||
$cacheKey = $strategy->generateKey($context);
|
||||
|
||||
// 4. Cache-Lookup
|
||||
$cached = $this->cache->get($cacheKey);
|
||||
if ($cached->isHit) {
|
||||
$result = $this->cache->get($cacheKey);
|
||||
$cached = $result->getItem($cacheKey);
|
||||
if ($cached->isHit && is_string($cached->value)) {
|
||||
return $cached->value;
|
||||
}
|
||||
|
||||
// 5. Rendern und cachen
|
||||
$content = $renderer();
|
||||
$ttl = $strategy->getTtl($context);
|
||||
|
||||
$this->cache->set($cacheKey, $content, $ttl);
|
||||
if (! is_string($content)) {
|
||||
throw new \RuntimeException('Renderer must return a string, got: ' . get_debug_type($content));
|
||||
}
|
||||
|
||||
$ttl = $strategy->getTtl($context);
|
||||
$this->cache->set(CacheItem::forSet($cacheKey, $content, \App\Framework\Core\ValueObjects\Duration::fromSeconds($ttl)));
|
||||
|
||||
return $content;
|
||||
}
|
||||
@@ -106,7 +118,7 @@ class CacheManager
|
||||
};
|
||||
}
|
||||
|
||||
private function invalidateByPattern(null $pattern): int
|
||||
private function invalidateByPattern(string $pattern): int
|
||||
{
|
||||
// Vereinfachte Implementation - in Realität müsste das der Cache-Driver unterstützen
|
||||
// Für jetzt: Cache komplett leeren bei Pattern-Match
|
||||
|
||||
Reference in New Issue
Block a user