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:
69
tests/debug/simple-cache-test.php
Normal file
69
tests/debug/simple-cache-test.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
echo "🧪 Simple Cache Test\n";
|
||||
echo "==================\n\n";
|
||||
|
||||
use App\Framework\Cache\CacheInitializer;
|
||||
use App\Framework\Cache\CacheItem;
|
||||
use App\Framework\Cache\CacheKey;
|
||||
use App\Framework\Core\PathProvider;
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
use App\Framework\DateTime\SystemClock;
|
||||
use App\Framework\DI\DefaultContainer;
|
||||
use App\Framework\Performance\EnhancedPerformanceCollector;
|
||||
|
||||
try {
|
||||
// Setup
|
||||
$container = new DefaultContainer();
|
||||
$performanceCollector = new EnhancedPerformanceCollector();
|
||||
$pathProvider = new PathProvider(__DIR__ . '/../..');
|
||||
$clock = new SystemClock();
|
||||
|
||||
$container->instance(PathProvider::class, $pathProvider);
|
||||
$container->instance(EnhancedPerformanceCollector::class, $performanceCollector);
|
||||
$container->instance(SystemClock::class, $clock);
|
||||
|
||||
echo "1. Initializing cache...\n";
|
||||
$cacheInitializer = new CacheInitializer($performanceCollector, $container);
|
||||
$cache = $cacheInitializer();
|
||||
|
||||
echo " Cache class: " . get_class($cache) . "\n";
|
||||
|
||||
// Test basic cache operations
|
||||
echo "\n2. Testing basic cache operations...\n";
|
||||
$testKey = CacheKey::fromString('test_simple');
|
||||
$testData = ['hello' => 'world', 'time' => time()];
|
||||
|
||||
$cacheItem = CacheItem::forSetting(
|
||||
key: $testKey,
|
||||
value: $testData,
|
||||
ttl: Duration::fromMinutes(5)
|
||||
);
|
||||
|
||||
echo " Writing to cache...\n";
|
||||
$writeResult = $cache->set($cacheItem);
|
||||
echo " Write result: " . ($writeResult ? 'SUCCESS' : 'FAILED') . "\n";
|
||||
|
||||
echo " Reading from cache...\n";
|
||||
$readResult = $cache->get($testKey);
|
||||
echo " Read result class: " . get_class($readResult) . "\n";
|
||||
|
||||
if ($readResult->has($testKey)) {
|
||||
$cachedItem = $readResult->get($testKey);
|
||||
echo " Cache hit: " . ($cachedItem->isHit ? 'YES' : 'NO') . "\n";
|
||||
echo " Cached value: " . json_encode($cachedItem->value) . "\n";
|
||||
} else {
|
||||
echo " ❌ Cache miss - key not found\n";
|
||||
}
|
||||
|
||||
echo "\n✅ Test completed successfully!\n";
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
echo "\n❌ Error: " . $e->getMessage() . "\n";
|
||||
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
||||
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user