首先确认服务器已经安装redis服务,php安装了redis扩展.
因为我们在laravel的项目中需要下载laravel的redis扩展
```
composer require predis/predis
```
1.修改config/cache.php(我们也可以谢盖env文件将 CACHE_DRIVER=redis)
![](https://box.kancloud.cn/c3bd126b4e441aaf4ad14a2bba84186e_1010x91.png)
```
//'redis' => [
// 'driver' => 'redis',
// 'connection' => 'cache',
//],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'options' => [
'cluster' => 'redis',
],
],
```
![](https://box.kancloud.cn/7b24d985955f0c388e9cacd2970096e3_1307x491.png)