getItem($cacheKey); if (!$cachedFile->isHit()) { // File is not cached, download it $httpClient = new Client(); $response = $httpClient->get($fileUrl); $fileContent = $response->getBody()->getContents(); // Save the file content to cache $cachedFile->set($fileContent); $cachedFile->expiresAfter(86400 * 7); // Cache for 7 days $cache->save($cachedFile); echo "ICANN TLD List downloaded and cached.".PHP_EOL; } else { // Retrieve the file content from the cache $fileContent = $cachedFile->get(); echo "ICANN TLD List loaded from cache.".PHP_EOL; }