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"; }