I am using laravel version 5.5.*
with Redis for Caching. Everything is working perfectly. My controller codes are look like -
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\Controller;
class UserController extends Controller {
public function showProfile($id) {
if(!$user = Redis::get('user:profile:'.$id)){
$user = SomeModelClass::user($id);
}
return view('user.profile', ['user' => $user]);
}
}
But when Redis server is down/unreachable, then below exception occurred.
Predis\Connection\ConnectionException
php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://127.0.0.1:6379]
I want to run this method without any exception when Redis host is down/unreachable. Is there any option to do that? Help is appreciable.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire