Update: 2026-05-06 21:24:56
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user