connection(); $conn->getPdo()->exec('SELECT 1'); $response = Redis::ping(); if ($response->getPayload() !== 'PONG') { throw new \Exception('Redis ping failed'); } } catch (\Exception $e) { return JsonResponseFactory::createJsonResponse( [ 'status_code' => CodesEnum::SERVICE_UNAVAILABLE->value, 'message' => 'Healthcheck Failed', 'error' => $e->getMessage(), ], CodesEnum::SERVICE_UNAVAILABLE ); } return JsonResponseFactory::createJsonResponse( new GenericResponse('Healthcheck OK', CodesEnum::OK->value) ); } }