I have installed redis with laravel by adding "predis/predis":"~1.0"
,
Then for testing i added the following code :
public function showRedis($id = 1)
{
$user = Redis::get('user:profile:'.$id);
Xdd($user);
}
In app/config/database.php i have :
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
它抛出以下错误:No connection could be made because the target machine actively refused it. [tcp://127.0.0.1:6379]
我用virtualhost
英镑做这个项目.