Update: 2026-05-06 21:24:56

This commit is contained in:
Hamza-Ayed
2026-05-06 21:24:56 +03:00
parent 3d4e636fbe
commit dd364fc918
6 changed files with 329 additions and 6 deletions

View File

@@ -19,6 +19,10 @@ class Cache
$pass = env('REDIS_PASSWORD', null);
try {
if (!class_exists('\Predis\Client')) {
throw new \Exception('Predis client is not installed. Please run composer install.');
}
self::$client = new \Predis\Client([
'scheme' => 'tcp',
'host' => $host,
@@ -26,7 +30,7 @@ class Cache
'password' => $pass,
]);
self::$client->connect();
} catch (\Exception $e) {
} catch (\Throwable $e) { // Catch \Throwable instead of \Exception to catch fatal class errors
error_log("Redis Connection Error: " . $e->getMessage());
return null;
}